These warnings are coming on default Fedora 28 build and probably others using gcc 8.1
../shared.c: In function ‘expand_macro’:
../shared.c:483:3: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
strncpy(name, value, len);
^~~~~~~~~~~~~~~~~~~~~~~~~
../shared.c:480:9: note: length computed here
len = strlen(value);
^~~~~~~~~~~~~
strncpy with a computed length via strlen is usually
not the right thing.
Signed-off-by: Andy Green <andy@warmcat.com>
len = strlen(value);
if (len > maxlength)
len = maxlength;
- strncpy(name, value, len);
+ memcpy(name, value, len);
}
return name + len;
}