mirror of
https://github.com/postgres/postgres.git
synced 2025-05-29 00:03:09 -04:00
Silence Coverity complaint about possible null-pointer dereference.
If pg_init_privs were to contain a NULL ACL field, this code would pass old_acl == NULL to merge_acl_with_grant, which would crash. The case shouldn't happen, but it just takes a couple more lines of code to guard against it, so do so. Oversight in 534287403; no back-patch needed.
This commit is contained in:
parent
c34d7df6ad
commit
713cfaf2a5
@ -4934,6 +4934,7 @@ RemoveRoleFromInitPriv(Oid roleid, Oid classid, Oid objid, int32 objsubid)
|
||||
/*
|
||||
* Generate new ACL. Grantor of rights is always the same as the owner.
|
||||
*/
|
||||
if (old_acl != NULL)
|
||||
new_acl = merge_acl_with_grant(old_acl,
|
||||
false, /* is_grant */
|
||||
false, /* grant_option */
|
||||
@ -4942,6 +4943,8 @@ RemoveRoleFromInitPriv(Oid roleid, Oid classid, Oid objid, int32 objsubid)
|
||||
ACLITEM_ALL_PRIV_BITS,
|
||||
ownerId,
|
||||
ownerId);
|
||||
else
|
||||
new_acl = NULL; /* this case shouldn't happen, probably */
|
||||
|
||||
/* If we end with an empty ACL, delete the pg_init_privs entry. */
|
||||
if (new_acl == NULL || ACL_NUM(new_acl) == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user