[MDEV-13951] mariadb-10.2.9/storage/connect/macutil.cpp:232: pointless call to strncpy ? Created: 2017-09-29  Updated: 2017-09-29

Status: Open
Project: MariaDB Server
Component/s: Compiling, Storage Engine - Connect
Affects Version/s: 10.2.9
Fix Version/s: 10.2

Type: Bug Priority: Minor
Reporter: David Binderman Assignee: Olivier Bertrand
Resolution: Unresolved Votes: 0
Labels: cppcheck


 Description   

mariadb-10.2.9/storage/connect/macutil.cpp:232] -> [mariadb-10.2.9/storage/connect/macutil.cpp:234]: (performance) Buffer 'buf' is being written before its old content has been used.

Source code is

      if ((p = strstr(Curp->Description, " - Packet Scheduler Miniport"))) {
        strncpy(buf, Curp->Description, p - Curp->Description);
        i = p - Curp->Description;
        strncpy(buf, Curp->Description, i);
        buf[i] = 0;

The first call to strncpy looks pointless.


Generated at Thu Feb 08 08:09:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.