From: Eric Leblond <eric@regit.org>
To: Alexandru Ardelean <ardeleanalex@gmail.com>
Cc: netfilter-devel@vger.kernel.org, Eric Leblond <eric@regit.org>
Subject: [PATCH] ulogd: use strncpy instead of memcpy
Date: Tue, 21 Mar 2017 21:56:57 +0100 [thread overview]
Message-ID: <20170321205657.9945-1-eric@regit.org> (raw)
In-Reply-To: <1490129693.2157.21.camel@regit.org>
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.11.0
next prev parent reply other threads:[~2017-03-21 20:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 8:31 [PATCH] ulogd: add +1 char for null char Alexandru Ardelean
2017-03-21 20:54 ` Eric Leblond
2017-03-21 20:56 ` Eric Leblond [this message]
2017-03-22 7:07 ` Alexandru Ardelean
2017-03-22 15:56 ` Alexandru Ardelean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170321205657.9945-1-eric@regit.org \
--to=eric@regit.org \
--cc=ardeleanalex@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.