-
Notifications
You must be signed in to change notification settings - Fork 381
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
Fix partition probe for PCRE2 #2027
Conversation
I have built OpenSCAP from this PR's branch with PCRE 2 option inside the virtual machine that I'm using as an Automatus back end (ie. ssgts_rhel9 domain in text below) and I have installed it to the system. The outcome with the rule audit_rules_privileged_commands is the following:
|
The pcre_exec function can return a positive number or zero, zero is returned if the buffer isn't large enough. Therefore, we should allow also positive number return code. The commit also extends the test to cover the bug situation. Fixes: OpenSCAP#2026
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.
I did check that is works with with PCRE and PCRE2, thanks.
I do have one discussion point, though.
@@ -402,7 +402,7 @@ int partition_probe_main(probe_ctx *ctx, void *probe_arg) | |||
rc = oscap_pcre_exec(re, mnt_entp->mnt_dir, | |||
strlen(mnt_entp->mnt_dir), 0, 0, NULL, 0); | |||
|
|||
if (rc == 0) { | |||
if (rc >= 0) { |
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.
What do you think, would it make sense to use if (rc > OSCAP_PCRE_ERR_NOMATCH)
is such cases?
I have add OSCAP_PCRE_ERR_NOMATCH. |
Tests fail because we have new sysctl entries in the kernel:
LGTM. |
The pcre_exec function can return a positive number or zero, zero is returned if the buffer isn't large enough. Therefore, we should allow also positive number return code.
The commit also extends the test to cover the bug situation.
Fixes: #2026