From: Eric Leblond Date: Tue, 21 Mar 2017 20:49:46 +0000 (+0100) Subject: ulogd: use strncpy instead of memcpy X-Git-Tag: ulogd-2.0.7~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0c75c9d20b76ff3d496a776ce43341c752914c3;p=thirdparty%2Fulogd2.git ulogd: use strncpy instead of memcpy 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 Signed-off-by: Eric Leblond --- diff --git a/src/ulogd.c b/src/ulogd.c index 5b9a586..919a317 100644 --- a/src/ulogd.c +++ b/src/ulogd.c @@ -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);