Add auditEventStack null check in pgaudit_ExecutorCheckPerms_hook #250
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fix crash inside log_select_dml when called with an empty
auditEventStack.
log_select_dml
only logs an event afterexecuting this line.
pgaudit/pgaudit.c
Line 1148 in c214a2e
This expects auditEventStack to be non empty but some
extensions could be calling
ExecCheckRTPerms
outsideof executor or processUtility with an empty auditEventStack
which results in NPE crash.
As a fix, always check for auditEventStack to be non empty in
pgaudit_ExecutorCheckPerms_hook
before callinglog_select_dml
and avoid the crash.An IF branch in
pgaudit_ExecutorCheckPerms_hook
isalready checking for auditEventStack != NULL
pgaudit/pgaudit.c
Line 1491 in c214a2e
Issues
#212
Sign Off
Signed-off-by: Tanzeel Khan tzlkhan@amazon.com