1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

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>
This commit is contained in:
Douglas Bagnall 2019-05-08 14:09:56 +12:00 committed by Douglas Bagnall
parent 47f2264c5e
commit c737b61cb4

View File

@ -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;
}