From c737b61cb46cace806e634ec3b852546609acd93 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 8 May 2019 14:09:56 +1200 Subject: 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 Reviewed-by: Gary Lockyer --- librpc/ndr/ndr_string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'librpc') 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; } -- cgit v1.2.1