Details
-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
3
-
9223372036854775807
Description
smatch highlighted:
if (verbose != 0) { snprintf(cmdstr, sizeof(cmdstr), "%s", argv[4]); for (i = 5; i < argc; i++) snprintf(cmdstr + strlen(cmdstr), sizeof(cmdstr), " %s", argv[i]); printf("%s: starting %ld threads on device %s running %s\n", argv[0], threads, argv[3], cmdstr); }
Note how the other sprints inside of the for loop advances the cmdstr pointer, but dos not adjust the size of the string.
Really need to do sizeof(cmdstr) - strlen(cmdstr) there.