From 674f9cc1d9f45a955802571936ff275e0444b2ea Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 7 Sep 2011 08:15:00 +0200 Subject: [PATCH] s3:smb2cli: fix marshalling of smb2_create_blobs in smb2cli_create() metze Autobuild-User: Stefan Metzmacher Autobuild-Date: Wed Sep 7 10:21:55 CEST 2011 on sn-devel-104 --- source3/libsmb/smb2cli_create.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source3/libsmb/smb2cli_create.c b/source3/libsmb/smb2cli_create.c index 68bb98180ecc..2145ce25f6aa 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); } -- 2.34.1