Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH 0/1] Replace strncpy w/ memcpy to avoid -Wstringop-truncation



From: Wesley Schwengle <wesley@xxxxxxxxxxxxx>


Another warning that I saw when building from git on Debian with cc
8.3.0 was this one.

params.c: In function ‘assignstrvalue.part.16’:
params.c:2588:17: warning: ‘strncpy’ output truncated before terminating
nul copying as many bytes from a string as its length [-Wstringop-truncation]
strncpy(z + v->start, val, vlen);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
params.c:2571:20: note: length computed here
vlen = strlen(val);
^~~~~~~~~~~

In this case I replaces strncpy with memcpy().



Wesley Schwengle (1):
  Replace strncpy w/ memcpy to avoid -Wstringop-truncation

 Src/params.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.21.0.196.g041f5ea1cf



Messages sorted by: Reverse Date, Date, Thread, Author