lede-packages-rs

git clone git://archive.git.mtrnord.blog/MTRNord/lede-packages-rs.git
Log | Files | Refs | README | LICENSE

101-ulogd-use-strncpy-instead-of-memcpy.patch (890B)


      1 From e0c75c9d20b76ff3d496a776ce43341c752914c3 Mon Sep 17 00:00:00 2001
      2 From: Eric Leblond <eric@regit.org>
      3 Date: Tue, 21 Mar 2017 21:49:46 +0100
      4 Subject: [PATCH] ulogd: use strncpy instead of memcpy
      5 
      6 On some architecture, ulogd is not starting due to a
      7 crash in memcpy. This patch switches to strncpy to
      8 avoid the problem.
      9 
     10 Reported-by: Alexandru Ardelean <ardeleanalex@gmail.com>
     11 Signed-off-by: Eric Leblond <eric@regit.org>
     12 ---
     13  src/ulogd.c | 2 +-
     14  1 file changed, 1 insertion(+), 1 deletion(-)
     15 
     16 diff --git a/src/ulogd.c b/src/ulogd.c
     17 index 5b9a586..919a317 100644
     18 --- a/src/ulogd.c
     19 +++ b/src/ulogd.c
     20 @@ -668,7 +668,7 @@ pluginstance_alloc_init(struct ulogd_plugin *pl, char *pi_id,
     21  	INIT_LLIST_HEAD(&pi->plist);
     22  	pi->plugin = pl;
     23  	pi->stack = stack;
     24 -	memcpy(pi->id, pi_id, sizeof(pi->id));
     25 +	strncpy(pi->id, pi_id, ULOGD_MAX_KEYLEN);
     26  
     27  	ptr = (void *)pi + sizeof(*pi);
     28  
     29 -- 
     30 2.7.4
     31