]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
Fix null pointer dereference issue detected by coverity
authorShivani Bhardwaj <shivanib134@gmail.com>
Fri, 22 Feb 2019 12:50:15 +0000 (18:20 +0530)
committerShivani Bhardwaj <shivanib134@gmail.com>
Tue, 26 Mar 2019 18:01:28 +0000 (23:31 +0530)
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.

suricata/update/rule.py

index 91df0c802dbd2ad91b7625ba2f6e4034dbc04987..95d81a479b871106fc6b0ce39b66ec27dcd20282 100644 (file)
@@ -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)