summaryrefslogtreecommitdiff
path: root/source3/smbd/nttrans.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-10-16 20:44:41 +0000
committerJeremy Allison <jra@samba.org>2003-10-16 20:44:41 +0000
commitcdd02fa792c460b6022738d23e64ff4e3526ec11 (patch)
treee66cecda2b1cc0d74fe879ac7560bb70a38a5c0a /source3/smbd/nttrans.c
parenteafd0371402009db8051d04b1ae988e8f8817031 (diff)
downloadsamba-cdd02fa792c460b6022738d23e64ff4e3526ec11.tar.gz
samba-cdd02fa792c460b6022738d23e64ff4e3526ec11.tar.bz2
samba-cdd02fa792c460b6022738d23e64ff4e3526ec11.zip
Tidyup wrap checking.
Jeremy. (This used to be commit 707554bcce91f33d0931f9d99050aab50765f5ff)
Diffstat (limited to 'source3/smbd/nttrans.c')
-rw-r--r--source3/smbd/nttrans.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index b4e7a70088..19af61f190 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -2463,7 +2463,8 @@ due to being in oplock break state.\n", (unsigned int)function_code ));
if ((parameter_offset + parameter_count < parameter_offset) ||
(parameter_offset + parameter_count < parameter_count))
goto bad_param;
- if (smb_base(inbuf) + parameter_offset + parameter_count > inbuf + length)
+ if ((smb_base(inbuf) + parameter_offset + parameter_count > inbuf + length)||
+ (smb_base(inbuf) + parameter_offset + parameter_count < smb_base(inbuf)))
goto bad_param;
memcpy( params, smb_base(inbuf) + parameter_offset, parameter_count);
@@ -2473,7 +2474,8 @@ due to being in oplock break state.\n", (unsigned int)function_code ));
DEBUG(10,("reply_nttrans: data_count = %d\n",data_count));
if ((data_offset + data_count < data_offset) || (data_offset + data_count < data_count))
goto bad_param;
- if (smb_base(inbuf) + data_offset + data_count > inbuf + length)
+ if ((smb_base(inbuf) + data_offset + data_count > inbuf + length) ||
+ (smb_base(inbuf) + data_offset + data_count < smb_base(inbuf)))
goto bad_param;
memcpy( data, smb_base(inbuf) + data_offset, data_count);
@@ -2534,7 +2536,10 @@ due to being in oplock break state.\n", (unsigned int)function_code ));
if ((parameter_displacement + parameter_count < parameter_displacement) ||
(parameter_displacement + parameter_count < parameter_count))
goto bad_param;
- if (smb_base(inbuf) + parameter_offset + parameter_count >= inbuf + bufsize)
+ if (parameter_displacement > total_parameter_count)
+ goto bad_param;
+ if ((smb_base(inbuf) + parameter_offset + parameter_count >= inbuf + bufsize) ||
+ (smb_base(inbuf) + parameter_offset + parameter_count < smb_base(inbuf)))
goto bad_param;
if (parameter_displacement + params < params)
goto bad_param;
@@ -2548,7 +2553,10 @@ due to being in oplock break state.\n", (unsigned int)function_code ));
if ((data_displacement + data_count < data_displacement) ||
(data_displacement + data_count < data_count))
goto bad_param;
- if (smb_base(inbuf) + data_offset + data_count >= inbuf + bufsize)
+ if (data_displacement > total_data_count)
+ goto bad_param;
+ if ((smb_base(inbuf) + data_offset + data_count >= inbuf + bufsize) ||
+ (smb_base(inbuf) + data_offset + data_count < smb_base(inbuf)))
goto bad_param;
if (data_displacement + data < data)
goto bad_param;