diff mbox

[4/6] Properly NUL-terminate name in nfct_timeout_attr_set

Message ID 1330499742-28091-5-git-send-email-jengelh@medozas.de
State Accepted
Headers show

Commit Message

Jan Engelhardt Feb. 29, 2012, 7:15 a.m. UTC
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 src/libnetfilter_cttimeout.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/src/libnetfilter_cttimeout.c b/src/libnetfilter_cttimeout.c
index 707543a..1f7c63e 100644
--- a/src/libnetfilter_cttimeout.c
+++ b/src/libnetfilter_cttimeout.c
@@ -177,7 +177,8 @@  nfct_timeout_attr_set(struct nfct_timeout *t, uint32_t type, const void *data)
 {
 	switch(type) {
 	case NFCT_TIMEOUT_ATTR_NAME:
-		strncpy(t->name, data, 32);
+		strncpy(t->name, data, sizeof(t->name));
+		t->name[sizeof(t->name)-1] = '\0';
 		break;
 	case NFCT_TIMEOUT_ATTR_L3PROTO:
 		t->l3num = *((uint16_t *) data);