CC src/nut_la-nut.lo
In function ‘nut_ca_path’,
inlined from ‘nut_config.part.1’ at src/nut.c:181:12,
inlined from ‘nut_config’:
src/nut.c:148:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
strncpy(ca_path, value, (strlen(value) + 1));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/nut.c: In function ‘nut_config’:
src/nut.c:148:30: note: length computed here
strncpy(ca_path, value, (strlen(value) + 1));
^~~~~~~~~~~~~
CCLD nut.la
static int nut_ca_path(const char *value) {
if (value != NULL && strcmp(value, "") != 0) {
- ca_path = malloc(strlen(value) + 1);
- strncpy(ca_path, value, (strlen(value) + 1));
+ ca_path = strdup(value);
} else {
ca_path = NULL; // Should alread be set to NULL from initialization
}