conditionals: fix handling of empty string values#10172
conditionals: fix handling of empty string values#10172niedbalski wants to merge 4 commits intomasterfrom
Conversation
|
Please don't remove review requests in the future. |
leonardo-albertovich
left a comment
There was a problem hiding this comment.
Please change all the pointer validations to explicitly compare against NULL (not just the ones I marked).
| case FLB_RULE_OP_EQ: | ||
| case FLB_RULE_OP_NEQ: | ||
| /* Allow empty string values for equality comparisons */ | ||
| if (!value) { |
There was a problem hiding this comment.
Please modify this to explicitly compare with NULL.
There was a problem hiding this comment.
Also, wouldn't this be covered by the conditional in line 62? (which should be modified to explicitly compare the pointer values with NULL)
| 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.
Please modify this to explicitly compare with NULL.
Please refactor the second part of the term to make it clearer.
There was a problem hiding this comment.
Same as before, since I don't see a loop or goto I don't understand why do we need to check that value is not NULL here as well, could you please clarify this?
|
|
||
| /* Using cfl_variant_create_from_string instead of a non-existent cfl_variant_set_string */ | ||
| variant = cfl_variant_create_from_string((char *)value); | ||
| if (!variant) { |
There was a problem hiding this comment.
If you are not doing anything (ie. reporting) if cfl_variant_create_from_string returns NULL why do you have this code? returning variant would be the same.
|
Thank you for working on this. I hope this will be merged soon. |
Summary
Fixes #10168