From 797af9369bd78b5ba0e121dd88c5d11f5341479f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 27 Aug 2002 14:16:37 +0000 Subject: Ensure we have at least smb_size bytes before processing a packet. Jeremy. (This used to be commit 0385f7d7efed48fc8121fc0fbb433e9ca0954094) --- source3/smbd/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 372d96e79b..6b9e184afe 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -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); -- cgit