From 5df1c115391f2d673d3dd2dfb89146ce77639d41 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 28 Mar 2012 16:49:30 -0700 Subject: Start to add truncate checks on all uses of strlcpy(). Reading lwn has it's uses :-). Autobuild-User: Jeremy Allison Autobuild-Date: Thu Mar 29 20:48:15 CEST 2012 on sn-devel-104 --- lib/socket/interfaces.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/socket/interfaces.c') diff --git a/lib/socket/interfaces.c b/lib/socket/interfaces.c index 775956ba99..74c642372a 100644 --- a/lib/socket/interfaces.c +++ b/lib/socket/interfaces.c @@ -212,8 +212,12 @@ static int _get_interfaces(TALLOC_CTX *mem_ctx, struct iface_struct **pifaces) continue; } - strlcpy(ifaces[total].name, ifptr->ifa_name, - sizeof(ifaces[total].name)); + if (strlcpy(ifaces[total].name, ifptr->ifa_name, + sizeof(ifaces[total].name)) >= + sizeof(ifaces[total].name)) { + /* Truncation ! Ignore. */ + continue; + } total++; } -- cgit