summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/libsmb/smb2cli_create.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source3/libsmb/smb2cli_create.c b/source3/libsmb/smb2cli_create.c
index 68bb98180e..2145ce25f6 100644
--- a/source3/libsmb/smb2cli_create.c
+++ b/source3/libsmb/smb2cli_create.c
@@ -114,8 +114,10 @@ struct tevent_req *smb2cli_create_send(
blobs_offset = name_utf16_len;
blobs_offset = ((blobs_offset + 3) & ~3);
- SIVAL(fixed, 48, blobs_offset + SMB2_HDR_BODY + 56);
- SIVAL(fixed, 52, blob.length);
+ if (blob.length > 0) {
+ SIVAL(fixed, 48, blobs_offset + SMB2_HDR_BODY + 56);
+ SIVAL(fixed, 52, blob.length);
+ }
dyn_len = MAX(1, blobs_offset + blob.length);
dyn = talloc_zero_array(state, uint8_t, dyn_len);
@@ -129,7 +131,7 @@ struct tevent_req *smb2cli_create_send(
}
if (blob.data != NULL) {
- memcpy(dyn + blobs_offset - (SMB2_HDR_BODY + 56),
+ memcpy(dyn + blobs_offset,
blob.data, blob.length);
data_blob_free(&blob);
}