From: Douglas Bagnall Date: Fri, 10 Nov 2023 03:15:25 +0000 (+1300) Subject: lib/security:CA: tokens_are_comparable() accepts NULL operator X-Git-Tag: talloc-2.4.2~520 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33d2deec514048f200bfb57a7dd64d6f9876f42a;p=thirdparty%2Fsamba.git lib/security:CA: tokens_are_comparable() accepts NULL operator In some circumstances we are going to know general comparability without having an operator around to use. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/libcli/security/conditional_ace.c b/libcli/security/conditional_ace.c index 9f2899eaef5..36709018125 100644 --- a/libcli/security/conditional_ace.c +++ b/libcli/security/conditional_ace.c @@ -1273,7 +1273,8 @@ static bool tokens_are_comparable(const struct ace_condition_token *op, /* * we can't compare different types *unless* they are both * integers, or one is a bool and the other is an integer 0 or - * 1, and the operator is == or !=. + * 1, and the operator is == or != (or NULL, which for convenience, + * is treated as ==). */ //XXX actually it says "literal integers", do we need to check flags? if (lhs->type == rhs->type) { @@ -1286,7 +1287,8 @@ static bool tokens_are_comparable(const struct ace_condition_token *op, } /* is it == or != */ - if (op->type != CONDITIONAL_ACE_TOKEN_EQUAL && + if (op != NULL && + op->type != CONDITIONAL_ACE_TOKEN_EQUAL && op->type != CONDITIONAL_ACE_TOKEN_NOT_EQUAL) { return false; }