From 6d7781a0cfef141a647436cc0cc3e339fd3f413d Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Thu, 26 Apr 2012 11:30:36 +0200 Subject: HBAC: Prevent NULL dereference in hbac_evaluate 'info' is optional parameter and can be set to NULL --- src/providers/ipa/hbac_evaluator.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/providers') diff --git a/src/providers/ipa/hbac_evaluator.c b/src/providers/ipa/hbac_evaluator.c index a41aa5bb6..6190fe279 100644 --- a/src/providers/ipa/hbac_evaluator.c +++ b/src/providers/ipa/hbac_evaluator.c @@ -147,8 +147,10 @@ enum hbac_eval_result hbac_evaluate(struct hbac_rule **rules, } else { /* An error occurred processing this rule */ result = HBAC_EVAL_ERROR; - (*info)->code = ret; - (*info)->rule_name = strdup(rules[i]->name); + if (info) { + (*info)->code = ret; + (*info)->rule_name = strdup(rules[i]->name); + } /* Explicitly not checking the result of strdup(), since if * it's NULL, we can't do anything anyway. */ -- cgit