From c31d41d72199937f5902c3e32b88c4743522ef26 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 26 Oct 2023 17:28:44 +1300 Subject: [PATCH] libcli/security: sddl: guard against inconsistent msg pointers Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- libcli/security/sddl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libcli/security/sddl.c b/libcli/security/sddl.c index a0457e1605d..15943e6aa24 100644 --- a/libcli/security/sddl.c +++ b/libcli/security/sddl.c @@ -839,6 +839,15 @@ struct security_descriptor *sddl_decode_err_msg(TALLOC_CTX *mem_ctx, const char sd->revision = SECURITY_DESCRIPTOR_REVISION_1; sd->type = SEC_DESC_SELF_RELATIVE; + if (msg != NULL) { + if (msg_offset == NULL) { + DBG_ERR("Programmer misbehaviour\n"); + goto failed; + } + *msg = NULL; + *msg_offset = 0; + } + while (*sddl) { uint32_t flags; char c = sddl[0]; -- 2.47.3