summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-11-01 17:28:25 +0100
committerVolker Lendecke <vl@samba.org>2008-11-01 19:41:07 +0100
commitcc546c019159608744127eb19db0a39e38ed18c7 (patch)
treec1e1371a508284bc3ee72516b0b81b83c95c2074 /source3
parentab0561f3c39b2d10cc7d82940c9ec4bd7e4e16f8 (diff)
downloadsamba-cc546c019159608744127eb19db0a39e38ed18c7.tar.gz
samba-cc546c019159608744127eb19db0a39e38ed18c7.tar.bz2
samba-cc546c019159608744127eb19db0a39e38ed18c7.zip
In reply_search(), don't write to inbuf when splitting directory and mask
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/reply.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index c5abac77e2..8e80a219d4 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1339,27 +1339,21 @@ void reply_search(struct smb_request *req)
}
p = strrchr_m(directory,'/');
- if (!p) {
+ if ((p != NULL) && (*directory != '/')) {
+ mask = p + 1;
+ directory = talloc_strndup(ctx, directory,
+ PTR_DIFF(p, directory));
+ } else {
mask = directory;
directory = talloc_strdup(ctx,".");
- if (!directory) {
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- END_PROFILE(SMBsearch);
- return;
- }
- } else {
- *p = 0;
- mask = p+1;
}
- if (*directory == '\0') {
- directory = talloc_strdup(ctx,".");
- if (!directory) {
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- END_PROFILE(SMBsearch);
- return;
- }
+ if (!directory) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ END_PROFILE(SMBsearch);
+ return;
}
+
memset((char *)status,'\0',21);
SCVAL(status,0,(dirtype & 0x1F));