s3:smb2cli: fix marshalling of smb2_create_blobs in smb2cli_create()
authorStefan Metzmacher <metze@samba.org>
Wed, 7 Sep 2011 06:15:00 +0000 (08:15 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 7 Sep 2011 08:21:55 +0000 (10:21 +0200)
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Wed Sep  7 10:21:55 CEST 2011 on sn-devel-104

source3/libsmb/smb2cli_create.c

index 68bb98180ecc64f5324f5711e13f56a7fb4b347e..2145ce25f6aa6b7f7e2c33720d1be335fda6bc41 100644 (file)
@@ -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);
        }