summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2019-05-08 14:09:56 +1200
committerDouglas Bagnall <dbagnall@samba.org>2019-05-09 22:39:27 +0000
commitc737b61cb46cace806e634ec3b852546609acd93 (patch)
treea0293d8c93f5709c1d9bfbe4c967f4eaa35aa99f /librpc
parent47f2264c5e40ca283708310b1b28f03fad6a21a7 (diff)
downloadsamba-c737b61cb46cace806e634ec3b852546609acd93.tar.gz
librpc/ndr: make push_charset_to_null UTF-16 safe (CID 1399648)
The length is in test units, not bytes, and includes terminating nulls. For 16-bit character sets, the terminating null must be two bytes. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'librpc')
-rw-r--r--librpc/ndr/ndr_string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c
index cc3508616bb..0fefc887c30 100644
--- a/librpc/ndr/ndr_string.c
+++ b/librpc/ndr/ndr_string.c
@@ -682,7 +682,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_charset_to_null(struct ndr_push *ndr, int nd
const char *str = var;
if (str == NULL) {
- str = "";
+ str = "\0"; /* i.e. two zero bytes, for UTF16 null word. */
length = 1;
}