summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-08-13 08:50:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:35 -0500
commit9ab87e644e4dc54ebbcb8ad300fe338f4a809ba9 (patch)
tree0adc90bb3b75c7ef34f5dfd8b451c013de4b4b59
parent8a910d37ccc767eb8ab25ef2af3a136ad874346f (diff)
downloadsamba-9ab87e644e4dc54ebbcb8ad300fe338f4a809ba9.tar.gz
samba-9ab87e644e4dc54ebbcb8ad300fe338f4a809ba9.tar.xz
samba-9ab87e644e4dc54ebbcb8ad300fe338f4a809ba9.zip
r24357: Check wct in reply_nttrans[s]
-rw-r--r--source/smbd/nttrans.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c
index 1500c355d19..566e03008fb 100644
--- a/source/smbd/nttrans.c
+++ b/source/smbd/nttrans.c
@@ -3176,17 +3176,27 @@ int reply_nttrans(connection_struct *conn,
char *inbuf,char *outbuf,int size,int bufsize)
{
int outsize = 0;
- uint32 pscnt = IVAL(inbuf,smb_nt_ParameterCount);
- uint32 psoff = IVAL(inbuf,smb_nt_ParameterOffset);
- uint32 dscnt = IVAL(inbuf,smb_nt_DataCount);
- uint32 dsoff = IVAL(inbuf,smb_nt_DataOffset);
-
- uint16 function_code = SVAL( inbuf, smb_nt_Function);
+ uint32 pscnt;
+ uint32 psoff;
+ uint32 dscnt;
+ uint32 dsoff;
+ uint16 function_code;
NTSTATUS result;
struct trans_state *state;
START_PROFILE(SMBnttrans);
+ if (CVAL(inbuf, smb_wct) < 19) {
+ END_PROFILE(SMBnttrans);
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ }
+
+ pscnt = IVAL(inbuf,smb_nt_ParameterCount);
+ psoff = IVAL(inbuf,smb_nt_ParameterOffset);
+ dscnt = IVAL(inbuf,smb_nt_DataCount);
+ dsoff = IVAL(inbuf,smb_nt_DataOffset);
+ function_code = SVAL( inbuf, smb_nt_Function);
+
if (IS_IPC(conn) && (function_code != NT_TRANSACT_CREATE)) {
END_PROFILE(SMBnttrans);
return ERROR_DOS(ERRSRV,ERRaccess);
@@ -3353,6 +3363,11 @@ int reply_nttranss(connection_struct *conn, char *inbuf,char *outbuf,
show_msg(inbuf);
+ if (CVAL(inbuf, smb_wct) < 18) {
+ END_PROFILE(SMBnttranss);
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ }
+
for (state = conn->pending_trans; state != NULL;
state = state->next) {
if (state->mid == SVAL(inbuf,smb_mid)) {