]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/security: sddl_conditional_ace: ensure message is talloced
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 20 Oct 2023 23:56:24 +0000 (12:56 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 1 Nov 2023 20:10:45 +0000 (20:10 +0000)
It is simpler for the message to have consistent parentage; it
is easier to drop one message we'll never see than to talloc it.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libcli/security/sddl_conditional_ace.c

index 2f243bca6a679b0fba4fa6f1268bc32dc4a65518..82fa266e8b83cd3aee4df5453005ab4371165dae 100644 (file)
@@ -1299,7 +1299,8 @@ static void comp_error(struct ace_condition_sddl_compiler_context *comp,
        }
        return;
 fail:
-       comp->message = "failed to set error message";
+       comp->message = talloc_strdup(comp->mem_ctx,
+                                     "failed to set error message");
 }
 
 
@@ -2736,8 +2737,7 @@ struct ace_condition_script * ace_conditions_compile_sddl(
        bool ok;
        struct ace_condition_sddl_compiler_context comp = {};
 
-       /* just in case, a message for the next few tallocs */
-       *message = "allocation error";
+       *message = NULL;
        *message_offset = 0;
 
        ok = init_compiler_context(mem_ctx,