summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c3
-rw-r--r--source3/lib/util_sock.c5
2 files changed, 4 insertions, 4 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 87f15b8759..bbc9ceddca 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -529,8 +529,9 @@ void smb_setlen(char *buf,int len)
int set_message(char *buf,int num_words,int num_bytes,BOOL zero)
{
- if (zero)
+ if (zero && (num_words || num_bytes)) {
memset(buf + smb_size,'\0',num_words*2 + num_bytes);
+ }
SCVAL(buf,smb_wct,num_words);
SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes);
smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4);
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 91c3305996..12fc2ead95 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -662,8 +662,6 @@ BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout)
smb_read_error = 0;
- memset(buffer,'\0',smb_size + 100);
-
len = read_smb_length_return_keepalive(fd,buffer,timeout);
if (len < 0) {
DEBUG(10,("receive_smb_raw: length < 0!\n"));
@@ -708,8 +706,9 @@ BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout)
}
if (ret != len) {
- if (smb_read_error == 0)
+ if (smb_read_error == 0) {
smb_read_error = READ_ERROR;
+ }
return False;
}