Skip to content

Commit

Permalink
NUL-terminate the input buffer by assignment rather than using memset()
Browse files Browse the repository at this point in the history
Writing a final NUL-terminator is sufficient rather than zeroing out the
unused slice of the input buffer. Suppresses a false-positive reported
by Coverity Scan.

Coverity CID 163308; Severity: Insignificant
  • Loading branch information
mptre committed Aug 11, 2017
1 parent cd3fcca commit 3e04320
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pick.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ get_choices(void)
err(1, NULL);
size *= 2;
}
memset(buf + length, '\0', size - length);
buf[length] = '\0';

choices.size = 16;
if ((choices.v = reallocarray(NULL, choices.size,
Expand Down

0 comments on commit 3e04320

Please sign in to comment.