[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3095-g09fa53d

Jeremy Allison jra at samba.org
Thu Oct 16 18:59:43 GMT 2008


The branch, v3-2-test has been updated
       via  09fa53d927436310ae3c17096d42e2fa4de1dd2e (commit)
      from  7c53cde257515e7bfffc8f3c0b54b7c99554d240 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 09fa53d927436310ae3c17096d42e2fa4de1dd2e
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Oct 16 11:57:51 2008 -0700

    Fix bug 5826 - Directory/Filenames get truncated when 3.2.0 client acesses old server.
    Karolin this is a show-stopper for 3.2.5.
    There was some code in pull_ucs2_base_talloc() to cope with this case which
    hadn't been added to pull_ascii_base_talloc(). The older Samba returns non
    unicode names which is why you are seeing this codepath being executed.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source/lib/charcnv.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/charcnv.c b/source/lib/charcnv.c
index cea234f..eec7ae3 100644
--- a/source/lib/charcnv.c
+++ b/source/lib/charcnv.c
@@ -1209,7 +1209,21 @@ static size_t pull_ascii_base_talloc(TALLOC_CTX *ctx,
 	if (dest_len && dest) {
 		/* Did we already process the terminating zero ? */
 		if (dest[dest_len-1] != 0) {
-			dest[dest_len-1] = 0;
+			size_t size = talloc_get_size(dest);
+			/* Have we got space to append the '\0' ? */
+			if (size <= dest_len) {
+				/* No, realloc. */
+				dest = TALLOC_REALLOC_ARRAY(ctx, dest, char,
+						dest_len+1);
+				if (!dest) {
+					/* talloc fail. */
+					dest_len = (size_t)-1;
+					return 0;
+				}
+			}
+			/* Yay - space ! */
+			dest[dest_len] = '\0';
+			dest_len++;
 		}
 	} else if (dest) {
 		dest[0] = 0;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list