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

r24500: Add check that bcc is correct in an incoming packet.

Jeremy.
(This used to be commit 267a0ac48d)
This commit is contained in:
Jeremy Allison 2007-08-16 23:53:51 +00:00 committed by Gerald (Jerry) Carter
parent 077d5d2e36
commit a662a62e5a

View File

@ -70,13 +70,22 @@ void init_smb_request(struct smb_request *req, const uint8 *inbuf)
req->vuid = SVAL(inbuf, smb_uid);
req->tid = SVAL(inbuf, smb_tid);
req->wct = CVAL(inbuf, smb_wct);
/* Ensure we have at least wct words. */
/* Ensure we have at least wct words and 2 bytes of bcc. */
if (smb_size + req->wct*2 > req_size) {
DEBUG(0,("init_smb_request: invalid wct number %u (size %u)\n",
(unsigned int)req->wct,
(unsigned int)req_size));
exit_server_cleanly("Invalid SMB request");
}
/* Ensure bcc is correct. */
if (((uint8 *)smb_buf(inbuf)) + smb_buflen(inbuf) > inbuf + req_size) {
DEBUG(0,("init_smb_request: invalid bcc number %u "
"(wct = %u, size %u)\n",
(unsigned int)smb_buflen(inbuf),
(unsigned int)req->wct,
(unsigned int)req_size));
exit_server_cleanly("Invalid SMB request");
}
req->inbuf = inbuf;
req->outbuf = NULL;
}