summaryrefslogtreecommitdiff
path: root/source4/libcli/smb2
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-11-16 13:34:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:46:20 -0500
commited069c1771843e0de0489bad7e0959c34fd260c8 (patch)
tree1f0fefffdd9aec44c1ec5ea2c882498833c801cb /source4/libcli/smb2
parente9eb56068573d89f8ce45f08220ca870b3daa669 (diff)
downloadsamba-ed069c1771843e0de0489bad7e0959c34fd260c8.tar.gz
samba-ed069c1771843e0de0489bad7e0959c34fd260c8.tar.bz2
samba-ed069c1771843e0de0489bad7e0959c34fd260c8.zip
r11742: fix pushing of 0 length blobs
metze (This used to be commit e985ab117c6afb2ea575b55bfaa97b0795ec5745)
Diffstat (limited to 'source4/libcli/smb2')
-rw-r--r--source4/libcli/smb2/request.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c
index bb8ff06e2d..a9a7e6b71f 100644
--- a/source4/libcli/smb2/request.c
+++ b/source4/libcli/smb2/request.c
@@ -252,6 +252,12 @@ NTSTATUS smb2_push_o16s16_blob(struct smb2_request_buffer *buf, uint8_t *ptr, DA
return NT_STATUS_BUFFER_TOO_SMALL;
}
+ if (blob.length == 0) {
+ SSVAL(ptr, 0, 0);
+ SSVAL(ptr, 4, 0);
+ return NT_STATUS_OK;
+ }
+
offset = buf->dynamic - buf->hdr;
padding_length = smb2_padding_size(offset, 2);
offset += padding_length;
@@ -318,6 +324,12 @@ NTSTATUS smb2_push_o16s32_blob(struct smb2_request_buffer *buf, uint8_t *ptr, DA
return NT_STATUS_BUFFER_TOO_SMALL;
}
+ if (blob.length == 0) {
+ SSVAL(ptr, 0, 0);
+ SIVAL(ptr, 4, 0);
+ return NT_STATUS_OK;
+ }
+
offset = buf->dynamic - buf->hdr;
padding_length = smb2_padding_size(offset, 2);
offset += padding_length;
@@ -382,6 +394,12 @@ NTSTATUS smb2_push_o32s32_blob(struct smb2_request_buffer *buf, uint8_t *ptr, DA
return NT_STATUS_BUFFER_TOO_SMALL;
}
+ if (blob.length == 0) {
+ SIVAL(ptr, 0, 0);
+ SIVAL(ptr, 4, 0);
+ return NT_STATUS_OK;
+ }
+
offset = buf->dynamic - buf->hdr;
padding_length = smb2_padding_size(offset, 8);
offset += padding_length;