From: Roel van Meer Date: Tue, 4 Aug 2015 14:50:43 +0000 (+0200) Subject: s3-util: Compare the maximum allowed length of a NetBIOS name X-Git-Tag: samba-4.2.4~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08bbbbc87f7dd2b9f09b85ca7e361046095d2fb5;p=thirdparty%2Fsamba.git s3-util: Compare the maximum allowed length of a NetBIOS name This fixes a problem where is_myname() returns true if one of our names is a substring of the specified name. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11427 Reviewed-by: Jeremy Allison Reviewed-by: Andreas Schneider (cherry picked from commit 4e178ed498c594ffcd5592d0b792d47b064b9586) Autobuild-User(v4-2-test): Stefan Metzmacher Autobuild-Date(v4-2-test): Mon Aug 31 12:33:42 CEST 2015 on sn-devel-104 --- diff --git a/source3/lib/util.c b/source3/lib/util.c index 03c0d3ecb9d..087ea6d2bed 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1197,7 +1197,7 @@ bool is_myname(const char *s) for (n=0; my_netbios_names(n); n++) { const char *nbt_name = my_netbios_names(n); - if (strncasecmp_m(nbt_name, s, strlen(nbt_name)) == 0) { + if (strncasecmp_m(nbt_name, s, MAX_NETBIOSNAME_LEN-1) == 0) { ret=True; break; }