1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-01 21:18:10 +03:00

Ensure we have at least smb_size bytes before processing a packet.

Jeremy.
(This used to be commit 0385f7d7ef)
This commit is contained in:
Jeremy Allison 2002-08-27 14:16:37 +00:00
parent c53bbb55f6
commit 797af9369b

View File

@ -654,7 +654,7 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
last_message = type;
/* Make sure this is an SMB packet */
if (strncmp(smb_base(inbuf),"\377SMB",4) != 0) {
if ((strncmp(smb_base(inbuf),"\377SMB",4) != 0) || (size - 4 < smb_size)) {
DEBUG(2,("Non-SMB packet of length %d. Terminating server\n",smb_len(inbuf)));
exit_server("Non-SMB packet");
return(-1);