diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-10-29 06:01:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:00 -0500 |
commit | bc24603e41804a1d54ff85f9114f0288a03483fa (patch) | |
tree | 900c5af5aa86d3bb71a7ac6a6624cdb698207cc1 /source4/smb_server | |
parent | 072dfad0afc9940c4c51cbecad9b3acf0cc38844 (diff) | |
download | samba-bc24603e41804a1d54ff85f9114f0288a03483fa.tar.gz samba-bc24603e41804a1d54ff85f9114f0288a03483fa.tar.bz2 samba-bc24603e41804a1d54ff85f9114f0288a03483fa.zip |
r3355: fixed the old style search code in smb_server to correctly handle
searches that go beyond the negotiated max xmit size
(This used to be commit 84762a59763005f5d29106cd409867cb150d648f)
Diffstat (limited to 'source4/smb_server')
-rw-r--r-- | source4/smb_server/search.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source4/smb_server/search.c b/source4/smb_server/search.c index b7b3d10ab6..adcafccafa 100644 --- a/source4/smb_server/search.c +++ b/source4/smb_server/search.c @@ -65,10 +65,14 @@ struct search_state { /* fill a single entry in a search find reply */ -static void find_fill_info(struct smbsrv_request *req, +static BOOL find_fill_info(struct smbsrv_request *req, union smb_search_data *file) { char *p; + + if (req->out.data_size + 43 > req_max_data(req)) { + return False; + } req_grow_data(req, req->out.data_size + 43); p = req->out.data + req->out.data_size - 43; @@ -84,6 +88,8 @@ static void find_fill_info(struct smbsrv_request *req, memset(p+30, ' ', 12); memcpy(p+30, file->search.name, MIN(strlen(file->search.name)+1, 12)); SCVAL(p,42,0); + + return True; } /* callback function for search first/next */ @@ -91,9 +97,7 @@ static BOOL find_callback(void *private, union smb_search_data *file) { struct search_state *state = (struct search_state *)private; - find_fill_info(state->req, file); - - return True; + return find_fill_info(state->req, file); } /**************************************************************************** |