]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
ulogd: use strncpy instead of memcpy
authorEric Leblond <eric@regit.org>
Tue, 21 Mar 2017 20:49:46 +0000 (21:49 +0100)
committerEric Leblond <eric@regit.org>
Tue, 21 Mar 2017 20:49:46 +0000 (21:49 +0100)
On some architecture, ulogd is not starting due to a
crash in memcpy. This patch switches to strncpy to
avoid the problem.

Reported-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Signed-off-by: Eric Leblond <eric@regit.org>
src/ulogd.c

index 5b9a58691e374cc8c03176469b8d28de25b7fc86..919a3172497f8504d7baae12b381e2e55465b2b4 100644 (file)
@@ -668,7 +668,7 @@ pluginstance_alloc_init(struct ulogd_plugin *pl, char *pi_id,
        INIT_LLIST_HEAD(&pi->plist);
        pi->plugin = pl;
        pi->stack = stack;
-       memcpy(pi->id, pi_id, sizeof(pi->id));
+       strncpy(pi->id, pi_id, ULOGD_MAX_KEYLEN);
 
        ptr = (void *)pi + sizeof(*pi);