Netdev List
 help / color / mirror / Atom feed
* [PATCH 1/6] ip/ipnetns: prevent potential string buffer overflow
@ 2015-08-06 12:24 Phil Sutter
  2015-08-06 12:24 ` [PATCH 2/6] misc/ss: avoid NULL pointer dereference Phil Sutter
  2015-08-12 15:48 ` [PATCH 1/6] ip/ipnetns: prevent potential string buffer overflow Stephen Hemminger
  0 siblings, 2 replies; 8+ messages in thread
From: Phil Sutter @ 2015-08-06 12:24 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 ip/ipnetns.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index 3b704a4..32b0f51 100644
--- a/ip/ipnetns.c
+++ b/ip/ipnetns.c
@@ -178,7 +178,8 @@ static int netns_map_add(int nsid, char *name)
 		return -ENOMEM;
 	}
 	c->nsid = nsid;
-	strcpy(c->name, name);
+	strncpy(c->name, name, NAME_MAX);
+	c->name[NAME_MAX - 1] = '\0';
 
 	h = NSID_HASH_NSID(nsid);
 	hlist_add_head(&c->nsid_hash, &nsid_head[h]);
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-08-12 16:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-06 12:24 [PATCH 1/6] ip/ipnetns: prevent potential string buffer overflow Phil Sutter
2015-08-06 12:24 ` [PATCH 2/6] misc/ss: avoid NULL pointer dereference Phil Sutter
2015-08-06 12:24   ` [PATCH 3/6] misc/ss: simplify buffer realloc, fix checking realloc failure Phil Sutter
2015-08-06 12:24     ` [PATCH 4/6] misc/ss: add missing fclose() calls Phil Sutter
2015-08-06 12:24       ` [PATCH 5/6] lib/namespace: don't leak fd in error case Phil Sutter
2015-08-06 12:24         ` [PATCH 6/6] misc/ss: fix memory leak in user_ent_hash_build() Phil Sutter
     [not found]         ` <b64bd55adf5d4f96b8f4d6e414161fad@BRMWP-EXMB11.corp.brocade.com>
2015-08-12 16:27           ` Stephen Hemminger
2015-08-12 15:48 ` [PATCH 1/6] ip/ipnetns: prevent potential string buffer overflow Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox