summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-10-29 21:27:57 +0000
committerJeremy Allison <jra@samba.org>2003-10-29 21:27:57 +0000
commit5ca824a682bbcd9331f32935f9b423ae6d468816 (patch)
tree049e58740ad501eb0d888e98eac22006ff830250 /source3/smbd
parente893948e04136ed5b9ba08373a93dd55f81e2e24 (diff)
downloadsamba-5ca824a682bbcd9331f32935f9b423ae6d468816.tar.gz
samba-5ca824a682bbcd9331f32935f9b423ae6d468816.tar.bz2
samba-5ca824a682bbcd9331f32935f9b423ae6d468816.zip
Fixes to check for wraps which could cause coredumps.
Jeremy. (This used to be commit 124a8ddae63adff4f601242a8e6d05abcaf4d9bf)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/reply.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 011186ba89..3752507493 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -669,10 +669,9 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
time_t date;
int dirtype;
int outsize = 0;
- int numentries = 0;
+ unsigned int numentries = 0;
+ unsigned int maxentries = 0;
BOOL finished = False;
- int maxentries;
- int i;
char *p;
BOOL ok = False;
int status_len;
@@ -786,6 +785,9 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
numentries = 0;
p += DIR_STRUCT_SIZE;
} else {
+ unsigned int i;
+ maxentries = MIN(maxentries, ((BUFFER_SIZE - (p - outbuf))/DIR_STRUCT_SIZE));
+
DEBUG(8,("dirpath=<%s> dontdescend=<%s>\n",
conn->dirpath,lp_dontdescend(SNUM(conn))));
if (in_list(conn->dirpath, lp_dontdescend(SNUM(conn)),True))
@@ -845,7 +847,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
if ((! *directory) && dptr_path(dptr_num))
slprintf(directory, sizeof(directory)-1, "(%s)",dptr_path(dptr_num));
- DEBUG( 4, ( "%s mask=%s path=%s dtype=%d nument=%d of %d\n",
+ DEBUG( 4, ( "%s mask=%s path=%s dtype=%d nument=%u of %u\n",
smb_fn_name(CVAL(inbuf,smb_com)),
mask, directory, dirtype, numentries, maxentries ) );