[PATCH] Fix incorrect comparison of NetBIOS names

Andreas Schneider asn at samba.org
Tue Aug 25 09:04:36 UTC 2015


On Monday 24 August 2015 14:53:25 Jeremy Allison wrote:
> On Tue, Aug 18, 2015 at 07:41:55AM +0200, Roel van Meer wrote:
> > Hi list,
> > 
> > attached is a patch that fixes NetBIOS name comparison, where the
> > comparison returns true if two names are compared where one is a
> > substring of the other.
> > 
> > Can someone please review and push if ok?
> > 
> > Reported as https://bugzilla.samba.org/show_bug.cgi?id=11427
> 
> 100% correct - thanks ! Can I get a second Team
> reviewer please ? (Andreas I think this is your
> bug that I failed to catch in my review :-).

RB+

Thanks for the patch ...

> Cheers,
> 
> 	Jeremy.
> 
> > From dec426b8d207378952799895368401362250cc23 Mon Sep 17 00:00:00 2001
> > From: Roel van Meer <roel at 1afa.com>
> > Date: Tue, 4 Aug 2015 16:50:43 +0200
> > Subject: [PATCH] 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.
> > ---
> > 
> >  source3/lib/util.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/source3/lib/util.c b/source3/lib/util.c
> > index 2fd2b6b..d38d53a 100644
> > --- a/source3/lib/util.c
> > +++ b/source3/lib/util.c
> > @@ -1198,7 +1198,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;
> >  		
> >  		}

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list