ulogd: use strncpy instead of memcpy
authorAlexandru Ardelean <ardeleanalex@gmail.com>
Thu, 16 Mar 2017 19:33:41 +0000 (21:33 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 12 Jan 2018 10:24:43 +0000 (11:24 +0100)
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
(cherry picked from commit 953f951c5eb3841e619a18b3aeb95a652dbb9a93)

net/ulogd/Makefile
net/ulogd/patches/101-ulogd-use-strncpy-instead-of-memcpy.patch [new file with mode: 0644]

index 2fa9f6c780075a0017c21cb1ef1f67d728b22839..c6c5eb5ff6f4f3d07e4c9858492474f7da334e4f 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ulogd
 PKG_VERSION:=2.0.5
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=ftp://ftp.netfilter.org/pub/ulogd/ \
diff --git a/net/ulogd/patches/101-ulogd-use-strncpy-instead-of-memcpy.patch b/net/ulogd/patches/101-ulogd-use-strncpy-instead-of-memcpy.patch
new file mode 100644 (file)
index 0000000..3671a95
--- /dev/null
@@ -0,0 +1,31 @@
+From e0c75c9d20b76ff3d496a776ce43341c752914c3 Mon Sep 17 00:00:00 2001
+From: Eric Leblond <eric@regit.org>
+Date: Tue, 21 Mar 2017 21:49:46 +0100
+Subject: [PATCH] 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 <ardeleanalex@gmail.com>
+Signed-off-by: Eric Leblond <eric@regit.org>
+---
+ src/ulogd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+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);
+-- 
+2.7.4
+