-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
detect/bsize: Validate against content
buffer when available
#4997
Conversation
This commit updates the bsize documentation 1. Describe what happens when "content" immediately precedes "bsize" 2. Include the operators and 3. Include examples using the operators.
This commit causes the signature to be invalid if a content keyword immediately precedes bsize and the bsize value is incompatible with the content length.
This commit adds test cases that validate behavior when "content" immediately precedes "bsize".
|
||
static bool DetectBsizeCheckContent(const SigMatch *sm, const DetectBsizeData *bsz) | ||
{ | ||
uint16_t bytes_required; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if none of the members of the list are content
the error message will use this uninitialized variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also: the error won't make sense at all in this case
|
||
static bool DetectBsizeCheckContent(const SigMatch *sm, const DetectBsizeData *bsz) | ||
{ | ||
uint16_t bytes_required; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also: the error won't make sense at all in this case
Continued in #5014 |
Continuation of #4991
This PR adds additional validation when using the
bsize
keyword. If a one or morecontent
keywords immediately precedesbsize
, then thebsize
value is checked against each to see if a match is possible using the operation (=, <, >, <>
) and the value.An error is raised if
bsize
value prevents a match, e.g., the content length exceeds thebsize
value. Thebsize
operation and values are used to do the evaluation.Link to redmine ticket: 3682
Describe changes:
offset
value when validating bsize value.Companion Suricata PR #233