summaryrefslogtreecommitdiff
path: root/lib/ptm_lib.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/ptm_lib.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/ptm_lib.c')
-rw-r--r--lib/ptm_lib.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/ptm_lib.c b/lib/ptm_lib.c
index 737c60775f..a2ef045c7a 100644
--- a/lib/ptm_lib.c
+++ b/lib/ptm_lib.c
@@ -3,9 +3,7 @@
* Copyright (C) 2015 Cumulus Networks, Inc.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <zebra.h>
#include <stdio.h>
#include <stdlib.h>
@@ -450,7 +448,7 @@ ptm_lib_handle_t *ptm_lib_register(char *client_name, ptm_cmd_cb cmd_cb,
hdl = calloc(1, sizeof(*hdl));
if (hdl) {
- strncpy(hdl->client_name, client_name, PTMLIB_MAXNAMELEN - 1);
+ strlcpy(hdl->client_name, client_name, sizeof(hdl->client_name));
hdl->cmd_cb = cmd_cb;
hdl->notify_cb = notify_cb;
hdl->response_cb = response_cb;