summaryrefslogtreecommitdiff
path: root/lib/csv.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2024-10-17 14:34:10 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2024-10-22 14:51:25 +0200
commit4606612abe42ac7011d9daaf0ddd23bae8887b6b (patch)
treefd21defa5d64597ac0ae3386c23f89752de7df5b /lib/csv.c
parent84fd92c80e207e879632eb0b640e378074bab8cf (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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/csv.c b/lib/csv.c
index fdd89a0c7a..2cd0092f0a 100644
--- a/lib/csv.c
+++ b/lib/csv.c
@@ -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 */