diff options
author | Jeremy Allison <jra@samba.org> | 2004-09-04 01:57:16 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:52:36 -0500 |
commit | 571cc4811bc373a5b4aeda9e5635aff1ff650e06 (patch) | |
tree | 77ddb35ff88a031e5666cbbb54f338f96dbdf6a6 /source3/libsmb | |
parent | b755bdaa8eb7428e5da376762cd88ca416220682 (diff) | |
download | samba-571cc4811bc373a5b4aeda9e5635aff1ff650e06.tar.gz samba-571cc4811bc373a5b4aeda9e5635aff1ff650e06.tar.bz2 samba-571cc4811bc373a5b4aeda9e5635aff1ff650e06.zip |
r2224: Make nmbd more robust against bad netbios packets.
Jeremy.
(This used to be commit dd9b17abd6b32c090840c1a0b797fd774711cb3a)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/nmblib.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index d883c5308d..7f22ce0096 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -475,6 +475,11 @@ static BOOL parse_dgram(char *inbuf,int length,struct dgram_packet *dgram) dgram->datasize = length-offset; memcpy(dgram->data,inbuf+offset,dgram->datasize); + /* Paranioa. Ensure the last 2 bytes in the dgram buffer are + zero. This should be true anyway, just enforce it for paranioa sake. JRA. */ + SMB_ASSERT(dgram->datasize <= (sizeof(dgram->data)-2)); + memset(&dgram->data[sizeof(dgram->data)-2], '\0', 2); + return(True); } |