[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Sat Mar 31 00:00:04 MDT 2012
The branch, master has been updated
via 786cb13 Fix an IPv6 breakage I introduced by adding an strlcpy truncation check. Found by Matthieu Patou <mat at samba.org>.
from efd94d1 Fix bug #8831 - Inconsistent (with manpage) command-line switch for "help" in smbtree
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 786cb132e8f27e58e3ac90889f6ea1c997441bd6
Author: Jeremy Allison <jra at samba.org>
Date: Fri Mar 30 21:21:57 2012 -0700
Fix an IPv6 breakage I introduced by adding an strlcpy truncation check. Found by Matthieu Patou <mat at samba.org>.
The truncate of the strlcpy() here was a *desired* side effect.
strlcpy()/strlcat() should never be used like that. Be more
explicit about the truncation and don't use strlcpy here.
Autobuild-User: Jeremy Allison <jra at samba.org>
Autobuild-Date: Sat Mar 31 07:59:16 CEST 2012 on sn-devel-104
-----------------------------------------------------------------------
Summary of changes:
lib/util/util_net.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index 69e5324..36b3fcb 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -107,11 +107,18 @@ static bool interpret_string_addr_pref(struct sockaddr_storage *pss,
*/
if (p && (p > str) && ((scope_id = if_nametoindex(p+1)) != 0)) {
- size_t len = MIN(PTR_DIFF(p,str)+1, sizeof(addr));
- if (strlcpy(addr, str, len) >= len) {
- /* Truncate. */
+ /* Length of string we want to copy.
+ This is IP:v6:addr (removing the %ifname).
+ */
+ size_t len = PTR_DIFF(p,str);
+
+ if (len+1 > sizeof(addr)) {
+ /* string+nul too long for array. */
return false;
}
+ memcpy(addr, str, len);
+ addr[len] = '\0';
+
str = addr;
}
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list