[SCM] Samba Shared Repository - branch v3-5-test updated

Karolin Seeger kseeger at samba.org
Wed Mar 23 13:51:26 MDT 2011


The branch, v3-5-test has been updated
       via  9cddb8e Fix bug #8005 - smbtorture4 BASE-TCONDEV fails when tested on Samba
      from  f5eba15 nsswitch: fix a segfault in the krb5 locator plugin

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


- Log -----------------------------------------------------------------
commit 9cddb8e6df6cc47e22a572af164deaffc6e1a774
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 14 16:12:31 2011 -0700

    Fix bug #8005 - smbtorture4 BASE-TCONDEV fails when tested on Samba
    
    When pulling non-aligned ucs2 strings, we neglected to add in the
    pad byte to the buffer length we've eaten. This caused the device
    string in TCONX (which seems to be one of the few places that uses
    non-aligned ucs2 strings) to be incorrectly read.
    
    Volker please check.
    
    Jeremy.
    (cherry picked from commit e59a950c049679f0394ea41b463dbb9837eb5e63)

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

Summary of changes:
 source3/lib/charcnv.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 9ac9930..718f810 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -1342,6 +1342,7 @@ bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
 size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags)
 {
 	size_t ret;
+	size_t ucs2_align_len = 0;
 
 	if (dest_len == (size_t)-1) {
 		/* No longer allow dest_len of -1. */
@@ -1359,6 +1360,7 @@ size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_
 		src = (const void *)((const char *)src + 1);
 		if (src_len != (size_t)-1)
 			src_len--;
+		ucs2_align_len = 1;
 	}
 
 	if (flags & STR_TERMINATE) {
@@ -1394,7 +1396,7 @@ size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_
 		dest[0] = 0;
 	}
 
-	return src_len;
+	return src_len + ucs2_align_len;
 }
 
 /**
@@ -1420,6 +1422,7 @@ size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
 {
 	char *dest;
 	size_t dest_len;
+	size_t ucs2_align_len = 0;
 
 	*ppdest = NULL;
 
@@ -1438,6 +1441,7 @@ size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
 		src = (const void *)((const char *)src + 1);
 		if (src_len != (size_t)-1)
 			src_len--;
+		ucs2_align_len = 1;
 	}
 
 	if (flags & STR_TERMINATE) {
@@ -1503,7 +1507,7 @@ size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
 	}
 
 	*ppdest = dest;
-	return src_len;
+	return src_len + ucs2_align_len;
 }
 
 size_t pull_ucs2_fstring(char *dest, const void *src)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list