summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2007-11-21 18:31:35 -0800
committerJames Peach <jpeach@samba.org>2007-11-21 18:31:35 -0800
commit64b54e534008a1ac36b9ba21726ca0954fe00d63 (patch)
tree5a5e0f42c70d4afa14ba689bf4f97af321432510 /source3/smbd/trans2.c
parentfebaaae2021c2993d265cc48cf9fbef05cb4ed1b (diff)
parent7ef6c19074495110d5c0b698b05c4ee52a0744d6 (diff)
downloadsamba-64b54e534008a1ac36b9ba21726ca0954fe00d63.tar.gz
samba-64b54e534008a1ac36b9ba21726ca0954fe00d63.tar.bz2
samba-64b54e534008a1ac36b9ba21726ca0954fe00d63.zip
Merge ssh://git.samba.org/data/git/samba into v3-2-test
(This used to be commit 660ea443364e949ed06c28b00f0e1c3757f0da27)
Diffstat (limited to 'source3/smbd/trans2.c')
-rw-r--r--source3/smbd/trans2.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index bb24db9ee1..323d78cde1 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1371,7 +1371,9 @@ static bool get_lanman2_dir_entry(TALLOC_CTX *ctx,
SSVAL(p,20,mode);
p += 23;
nameptr = p;
- p += align_string(pdata, p, 0);
+ if (flags2 & FLAGS2_UNICODE_STRINGS) {
+ p += ucs2_align(base_data, p, 0);
+ }
len = srvstr_push(base_data, flags2, p,
fname, PTR_DIFF(end_data, p),
STR_TERMINATE);
@@ -2022,7 +2024,13 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
if(got_exact_match)
finished = True;
- space_remaining = max_data_bytes - PTR_DIFF(p,pdata);
+ /* Ensure space_remaining never goes -ve. */
+ if (PTR_DIFF(p,pdata) > max_data_bytes) {
+ space_remaining = 0;
+ out_of_space = true;
+ } else {
+ space_remaining = max_data_bytes - PTR_DIFF(p,pdata);
+ }
}
/* Check if we can close the dirptr */