From: Joseph Sutton Date: Thu, 21 Dec 2023 20:58:53 +0000 (+1300) Subject: librpc: Do not allow u16string to be encoded in a big‐endian context X-Git-Tag: talloc-2.4.2~196 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8a9f395821d62273e28f32895a4c3116a0606423;p=thirdparty%2Fsamba.git librpc: Do not allow u16string to be encoded in a big‐endian context Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c index 89ba8b0579b..323886b2fe5 100644 --- a/librpc/ndr/ndr_string.c +++ b/librpc/ndr/ndr_string.c @@ -491,6 +491,17 @@ _PUBLIC_ enum ndr_err_code ndr_pull_u16string(struct ndr_pull *ndr, return NDR_ERR_SUCCESS; } + if (NDR_BE(ndr)) { + /* + * It isn’t clear how this type should be encoded in a + * big‐endian context. + */ + return ndr_pull_error( + ndr, + NDR_ERR_STRING, + "u16string does not support big‐endian encoding\n"); + } + if (ndr->flags & LIBNDR_ENCODING_FLAGS) { return ndr_pull_error( ndr, @@ -552,6 +563,17 @@ _PUBLIC_ enum ndr_err_code ndr_push_u16string(struct ndr_push *ndr, return NDR_ERR_SUCCESS; } + if (NDR_BE(ndr)) { + /* + * It isn’t clear how this type should be encoded in a + * big‐endian context. + */ + return ndr_push_error( + ndr, + NDR_ERR_STRING, + "u16string does not support big‐endian encoding\n"); + } + if (s == NULL) { return ndr_push_error( ndr,