diff options
author | Volker Lendecke <vl@samba.org> | 2008-11-01 17:30:37 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-11-01 19:41:07 +0100 |
commit | ac97d7d4b023db8d0e0fef1dc7f2f7b88028eae3 (patch) | |
tree | 258f2f4346422cc6109cdbfabcff6dfd76400804 /source3/smbd | |
parent | cc546c019159608744127eb19db0a39e38ed18c7 (diff) | |
download | samba-ac97d7d4b023db8d0e0fef1dc7f2f7b88028eae3.tar.gz |
In reply_copy, don't write to inbuf when splitting directory and mask
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/reply.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 8e80a219d43..bbdf34e3e90 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -6141,8 +6141,9 @@ void reply_copy(struct smb_request *req) char *name = NULL; char *newname = NULL; char *directory = NULL; - char *mask = NULL; - char *p; + const char *mask = NULL; + const char mask_star[] = "*"; + const char *p; int count=0; int error = ERRnoaccess; int err = 0; @@ -6269,23 +6270,18 @@ void reply_copy(struct smb_request *req) } p = strrchr_m(name,'/'); - if (!p) { + if (p != NULL) { + directory = talloc_strndup(ctx, name, PTR_DIFF(p, name)); + mask = p+1; + } else { directory = talloc_strdup(ctx, "./"); - if (!directory) { - reply_nterror(req, NT_STATUS_NO_MEMORY); - END_PROFILE(SMBcopy); - return; - } mask = name; - } else { - *p = 0; - directory = talloc_strdup(ctx, name); - if (!directory) { - reply_nterror(req, NT_STATUS_NO_MEMORY); - END_PROFILE(SMBcopy); - return; - } - mask = p+1; + } + + if (!directory) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + END_PROFILE(SMBcopy); + return; } /* @@ -6353,8 +6349,7 @@ void reply_copy(struct smb_request *req) long offset = 0; if (strequal(mask,"????????.???")) { - mask[0] = '*'; - mask[1] = '\0'; + mask = mask_star; } status = check_name(conn, directory); |