Project

General

Profile

Actions

Optimization #7769

closed

DetectFileHashParse: remove redundant de_ctx->rule_file != NULL check

Added by Boris Tonofa 2 months ago. Updated about 10 hours ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Effort:
medium
Difficulty:
Label:

Description

When Suricata parses rules it invokes DetectFileHashParse() to turn a filemd5/sha1/sha256 keyword into an in-memory hash table. If the rules are supplied from memory, the parser context field de_ctx->rule_file is NULL; nevertheless the code still executes SCStrdup(de_ctx->rule_file). Because strdup(NULL) dereferences a null pointer inside strlen(), Suricata crashes with SIGSEGV during the rule-loading phase.

Actions

Also available in: Atom PDF