From c1a9486fafd4a47f1fb4adaeb564ab759137d05f Mon Sep 17 00:00:00 2001
From: Andrew Tridgell <tridge@samba.org>
Date: Tue, 4 Apr 2006 04:16:02 +0000
Subject: r14904: fixed LIBNDR_FLAG_STR_CHARLEN (thanks to Metze for noticing
 this) (This used to be commit 9569bf5374f92815ce1940f752aaff4a6913b4c0)

---
 source4/librpc/ndr/ndr_string.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'source4')

diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c
index 33d23ce7dc..80b900211d 100644
--- a/source4/librpc/ndr/ndr_string.c
+++ b/source4/librpc/ndr/ndr_string.c
@@ -315,7 +315,7 @@ _PUBLIC_ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const cha
 		flags &= ~LIBNDR_FLAG_STR_UTF8;
 	}
 
-	flags &= ~(LIBNDR_FLAG_STR_CONFORMANT | LIBNDR_FLAG_STR_CHARLEN);
+	flags &= ~LIBNDR_FLAG_STR_CONFORMANT;
 
 	if (!(flags & LIBNDR_FLAG_STR_NOTERM)) {
 		s_len++;
@@ -329,6 +329,9 @@ _PUBLIC_ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const cha
 	if (flags & LIBNDR_FLAG_STR_BYTESIZE) {
 		c_len = d_len;
 		flags &= ~LIBNDR_FLAG_STR_BYTESIZE;
+	} else if (flags & LIBNDR_FLAG_STR_CHARLEN) {
+		c_len = (d_len / byte_mul)-1;
+		flags &= ~LIBNDR_FLAG_STR_CHARLEN;
 	} else {
 		c_len = d_len / byte_mul;
 	}
-- 
cgit