From 4b587cd3ed32b416b43865bcc0afb21d7af3eecb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 May 1998 05:03:17 +0000 Subject: test for overflow in nmb name parsing code (This used to be commit 204a939807d6fe66fcd721aabf7a88ee33eb23d6) --- source3/libsmb/nmblib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index 6c178758c6..f59371d559 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -197,7 +197,7 @@ static int parse_nmb_name(char *inbuf,int offset,int length, struct nmb_name *na unsigned char c1,c2; c1 = ubuf[offset++]-'A'; c2 = ubuf[offset++]-'A'; - if ((c1 & 0xF0) || (c2 & 0xF0)) return(0); + if ((c1 & 0xF0) || (c2 & 0xF0) || (n > sizeof(name->name)-1)) return(0); name->name[n++] = (c1<<4) | c2; m -= 2; } -- cgit