summaryrefslogtreecommitdiff
path: root/source3/smbd/process.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-03-22 13:47:42 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-03-22 13:47:42 +0000
commit1f499a79f5468e87d26b60ffe3aa375b91cadbef (patch)
tree095f7f163807060eadd42bf84a876aac1724b062 /source3/smbd/process.c
parentb33cee92ed7e6729291616778963037f0d2f2f30 (diff)
downloadsamba-1f499a79f5468e87d26b60ffe3aa375b91cadbef.tar.gz
samba-1f499a79f5468e87d26b60ffe3aa375b91cadbef.tar.bz2
samba-1f499a79f5468e87d26b60ffe3aa375b91cadbef.zip
(merge from HEAD)
Small clenaup patches: - safe_string.h - don't assume that __FUNCTION__ is available - process.c - use new workaround from safe_string.h for the same - util.c - Show how many bytes we smb_panic()ed trying to smb_xmalloc() - gencache.c - Keep valgrind quiet by always null terminating. - clistr.c - Add copyright - srvstr.h - move srvstr_push into a .c file again, as a real function. - srvstr.c - revive, with 'safe' checked srvstr_push - loadparm.c - set a default for the display charset. - connection.c - use safe_strcpy() Andrew Bartlett (This used to be commit c91e76bddbe1244ddc8d12b092eba875834029ac)
Diffstat (limited to 'source3/smbd/process.c')
-rw-r--r--source3/smbd/process.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 57bc236eef..16ef30c46c 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1249,12 +1249,16 @@ void smbd_process(void)
extern int smb_echo_count;
time_t last_timeout_processing_time = time(NULL);
unsigned int num_smbs = 0;
+ const size_t total_buffer_size = BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE + SAFETY_MARGIN;
- InBuffer = (char *)malloc(BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE + SAFETY_MARGIN);
- OutBuffer = (char *)malloc(BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE + SAFETY_MARGIN);
+ InBuffer = (char *)malloc(total_buffer_size);
+ OutBuffer = (char *)malloc(total_buffer_size);
if ((InBuffer == NULL) || (OutBuffer == NULL))
return;
+ clobber_region(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, InBuffer, total_buffer_size);
+ clobber_region(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, OutBuffer, total_buffer_size);
+
max_recv = MIN(lp_maxxmit(),BUFFER_SIZE);
while (True) {
@@ -1278,6 +1282,8 @@ void smbd_process(void)
num_smbs = 0; /* Reset smb counter. */
}
+ clobber_region(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, InBuffer, total_buffer_size);
+
while (!receive_message_or_smb(InBuffer,BUFFER_SIZE+LARGE_WRITEX_HDR_SIZE,select_timeout)) {
if(!timeout_processing( deadtime, &select_timeout, &last_timeout_processing_time))
return;
@@ -1295,6 +1301,8 @@ void smbd_process(void)
*/
num_echos = smb_echo_count;
+ clobber_region(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, OutBuffer, total_buffer_size);
+
process_smb(InBuffer, OutBuffer);
if (smb_echo_count != num_echos) {