Author: tridge Date: 2004-10-29 06:01:51 +0000 (Fri, 29 Oct 2004) New Revision: 3355
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3355 Log: fixed the old style search code in smb_server to correctly handle searches that go beyond the negotiated max xmit size Modified: branches/SAMBA_4_0/source/smb_server/search.c Changeset: Modified: branches/SAMBA_4_0/source/smb_server/search.c =================================================================== --- branches/SAMBA_4_0/source/smb_server/search.c 2004-10-29 06:01:00 UTC (rev 3354) +++ branches/SAMBA_4_0/source/smb_server/search.c 2004-10-29 06:01:51 UTC (rev 3355) @@ -65,10 +65,14 @@ /* 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 @@ 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 @@ { struct search_state *state = (struct search_state *)private; - find_fill_info(state->req, file); - - return True; + return find_fill_info(state->req, file); } /****************************************************************************