diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2024-10-17 14:34:10 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2024-10-22 14:51:25 +0200 |
| commit | 4606612abe42ac7011d9daaf0ddd23bae8887b6b (patch) | |
| tree | fd21defa5d64597ac0ae3386c23f89752de7df5b /lib/csv.c | |
| parent | 84fd92c80e207e879632eb0b640e378074bab8cf (diff) | |
lib: remove `strncpy()` use
`checkpatch` has sufficiently annoyed me to fix this.
Includes free overflow guard in CSV code.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/csv.c')
| -rw-r--r-- | lib/csv.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -573,7 +573,7 @@ void csv_decode(csv_t *csv, char *inbuf) log_error("field str malloc failed\n"); return; } - strncpy(rec->record, buf, pos - buf + 1); + memcpy(rec->record, buf, MIN(pos - buf + 1, csv->buflen - 1)); } rec->rec_len = pos - buf + 1; /* decode record into fields */ |
