summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/smb2cli_create.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source3/libsmb/smb2cli_create.c b/source3/libsmb/smb2cli_create.c
index 50c9816ded..68bb98180e 100644
--- a/source3/libsmb/smb2cli_create.c
+++ b/source3/libsmb/smb2cli_create.c
@@ -77,12 +77,17 @@ struct tevent_req *smb2cli_create_send(
}
if (!convert_string_talloc(state, CH_UNIX, CH_UTF16,
- filename, strlen(filename)+1,
+ filename, strlen(filename),
&name_utf16, &name_utf16_len)) {
tevent_req_oom(req);
return tevent_req_post(req, ev);
}
+ if (strlen(filename) == 0) {
+ TALLOC_FREE(name_utf16);
+ name_utf16_len = 0;
+ }
+
fixed = state->fixed;
SSVAL(fixed, 0, 57);
@@ -118,8 +123,10 @@ struct tevent_req *smb2cli_create_send(
return tevent_req_post(req, ev);
}
- memcpy(dyn, name_utf16, name_utf16_len);
- TALLOC_FREE(name_utf16);
+ if (name_utf16) {
+ memcpy(dyn, name_utf16, name_utf16_len);
+ TALLOC_FREE(name_utf16);
+ }
if (blob.data != NULL) {
memcpy(dyn + blobs_offset - (SMB2_HDR_BODY + 56),