Browse Source

* use snprintf() instead strncpy() where possible

master
Alex 'AdUser' Z 9 years ago
parent
commit
9a118ad696
  1. 3
      src/backends/exec.c
  2. 3
      src/filters/preg.c

3
src/backends/exec.c

@ -155,8 +155,7 @@ create(const char *id) {
if ((cfg = calloc(1, sizeof(cfg_t))) == NULL)
return NULL;
strncpy(cfg->name, id, sizeof(cfg->name));
cfg->name[ID_MAX] = '\0';
snprintf(cfg->name, sizeof(cfg->name), "%s", id);
return cfg;
}

3
src/filters/preg.c

@ -35,8 +35,7 @@ create(const char *id) {
if ((cfg = calloc(1, sizeof(cfg_t))) == NULL)
return NULL;
strncpy(cfg->id, id, sizeof(cfg->id));
cfg->id[sizeof(cfg->id) - 1] = '\0';
snprintf(cfg->id, sizeof(cfg->id), "%s", id);
return cfg;
}

Loading…
Cancel
Save