]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/security: sddl: guard against inconsistent msg pointers
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 26 Oct 2023 04:28:44 +0000 (17:28 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 1 Nov 2023 20:10:46 +0000 (20:10 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libcli/security/sddl.c

index a0457e1605d0da63bc8d2890f8f244e384b9e417..15943e6aa24d495ca9a553fdbb5c731f1bfb1148 100644 (file)
@@ -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];