summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-11-01 17:30:37 +0100
committerVolker Lendecke <vl@samba.org>2008-11-01 19:41:07 +0100
commitac97d7d4b023db8d0e0fef1dc7f2f7b88028eae3 (patch)
tree258f2f4346422cc6109cdbfabcff6dfd76400804 /source3/smbd
parentcc546c019159608744127eb19db0a39e38ed18c7 (diff)
downloadsamba-ac97d7d4b023db8d0e0fef1dc7f2f7b88028eae3.tar.gz
samba-ac97d7d4b023db8d0e0fef1dc7f2f7b88028eae3.tar.bz2
samba-ac97d7d4b023db8d0e0fef1dc7f2f7b88028eae3.zip
In reply_copy, don't write to inbuf when splitting directory and mask
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/reply.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 8e80a219d4..bbdf34e3e9 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);