summaryrefslogtreecommitdiff
path: root/lib/socket
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-03-28 16:49:30 -0700
committerJeremy Allison <jra@samba.org>2012-03-29 20:48:15 +0200
commit5df1c115391f2d673d3dd2dfb89146ce77639d41 (patch)
tree6476e3ef1ad04b57f230f4f4167e04e020bce111 /lib/socket
parent762928945d8c18abbce1447fb0e731a4515ffb4c (diff)
downloadsamba-5df1c115391f2d673d3dd2dfb89146ce77639d41.tar.gz
samba-5df1c115391f2d673d3dd2dfb89146ce77639d41.tar.bz2
samba-5df1c115391f2d673d3dd2dfb89146ce77639d41.zip
Start to add truncate checks on all uses of strlcpy(). Reading lwn
has it's uses :-). Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Mar 29 20:48:15 CEST 2012 on sn-devel-104
Diffstat (limited to 'lib/socket')
-rw-r--r--lib/socket/interfaces.c8
1 files changed, 6 insertions, 2 deletions
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++;
}