Blob Blame History Raw
From 2aa3fc519050787aa05395b3821fbc4ddfe41ac5 Mon Sep 17 00:00:00 2001
From: Bart De Schuymer <bdschuym@pandora.be>
Date: Tue, 6 May 2014 21:07:13 +0200
Subject: [PATCH] arptables: fix potential buffer overflow (author: dcb)

(cherry picked from commit c29948407c6e1960b9ca0ff3f1479773c95d25c9)
Signed-off-by: Phil Sutter <psutter@redhat.com>
---
 arptables.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arptables.c b/arptables.c
index 3fb8ed5c40e73..64ac3aa226a2c 100644
--- a/arptables.c
+++ b/arptables.c
@@ -763,6 +763,7 @@ parse_hostnetworkmask(const char *name, struct in_addr **addrpp,
 	int i, j, k, n;
 
 	strncpy(buf, name, sizeof(buf) - 1);
+	buf[sizeof(buf) - 1] = '\0';
 	if ((p = strrchr(buf, '/')) != NULL) {
 		*p = '\0';
 		addrp = parse_mask(p + 1);
-- 
2.21.0