-
Notifications
You must be signed in to change notification settings - Fork 1.7k
conditionals: fix handling of empty string values #10172
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
base: master
Are you sure you want to change the base?
Changes from all commits
54e84e7
8729755
53bc772
9a8bfe2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,8 +66,14 @@ static struct flb_condition_rule *rule_create(const char *field, | |
switch (op) { | ||
case FLB_RULE_OP_EQ: | ||
case FLB_RULE_OP_NEQ: | ||
/* Allow empty string values for equality comparisons */ | ||
if (!value) { | ||
return NULL; | ||
} | ||
break; | ||
case FLB_RULE_OP_REGEX: | ||
case FLB_RULE_OP_NOT_REGEX: | ||
/* Regex patterns must not be empty */ | ||
if (!value || !((char *)value)[0]) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please modify this to explicitly compare with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as before, since I don't see a loop or goto I don't understand why do we need to check that |
||
return NULL; | ||
} | ||
|
Large diffs are not rendered by default.
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.
Please modify this to explicitly compare with
NULL
.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, wouldn't this be covered by the conditional in line 62? (which should be modified to explicitly compare the pointer values with
NULL
)