From: Shivani Bhardwaj Date: Fri, 22 Feb 2019 12:50:15 +0000 (+0530) Subject: Fix null pointer dereference issue detected by coverity X-Git-Tag: 1.1.0rc1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e079634849dc9697aba7633cc1ee50bb9bf5423;p=thirdparty%2Fsuricata-update.git Fix null pointer dereference issue detected by coverity Coverity scan of the current code raised the following issue: ``` >>> CID 327298: Null pointer dereferences (FORWARD_NULL) >>> Accessing a property of null-like value "val". 271 if val.find("noalert") > -1: ``` Fix this by adding a null check on val. Closes redmine ticket #2834. --- diff --git a/suricata/update/rule.py b/suricata/update/rule.py index 91df0c8..95d81a4 100644 --- a/suricata/update/rule.py +++ b/suricata/update/rule.py @@ -268,7 +268,7 @@ def parse(buf, group=None): rule[name] += [v.strip() for v in val.split(",")] elif name == "flowbits": rule.flowbits.append(val) - if val.find("noalert") > -1: + if val and val.find("noalert") > -1: rule["noalert"] = True elif name == "reference": rule.references.append(val)