summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/membuffer.c8
-rw-r--r--source3/lib/util.c4
2 files changed, 7 insertions, 5 deletions
diff --git a/source3/lib/membuffer.c b/source3/lib/membuffer.c
index 18e9fa9453..92bc2be439 100644
--- a/source3/lib/membuffer.c
+++ b/source3/lib/membuffer.c
@@ -79,7 +79,7 @@ void mem_init(struct mem_buf *buf, int margin)
dynamic indicates memory has been dynamically allocated.
if mem_free is called, the memory will be freed.
********************************************************************/
-void mem_create(struct mem_buf *buf, char *data, int size, int margin, BOOL dynamic)
+void mem_create(struct mem_buf *buf, char *data, int offset, int size, int margin, BOOL dynamic)
{
buf->dynamic = dynamic;
buf->data = data;
@@ -90,8 +90,8 @@ void mem_create(struct mem_buf *buf, char *data, int size, int margin, BOOL dyna
buf->next = NULL;
- buf->offset.start = 0;
- buf->offset.end = size;
+ buf->offset.start = offset;
+ buf->offset.end = offset + size;
}
/*******************************************************************
@@ -109,7 +109,7 @@ BOOL mem_alloc_data(struct mem_buf *buf, int size)
buf->data = malloc(buf->data_size);
- if (buf->data == NULL)
+ if (buf->data == NULL && size != 0)
{
DEBUG(3,("mem_alloc: could not malloc size %d\n",
buf->data_size));
diff --git a/source3/lib/util.c b/source3/lib/util.c
index f2cd2a99d1..e5486e6159 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2262,8 +2262,10 @@ BOOL client_receive_smb(int fd,char *buffer, unsigned int timeout)
{
ret = receive_smb(fd, buffer, timeout);
- if(ret == False)
+ if (!ret)
+ {
return ret;
+ }
/* Ignore session keepalive packets. */
if(CVAL(buffer,0) != 0x85)