Skip to content

Commit 8df01a7

Browse files
committed
sudoers_policy_store_result: Fix potential NULL pointer deref
sudo_get_gidlist() can return NULL value
1 parent cc3d47b commit 8df01a7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

plugins/sudoers/policy.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,10 @@ sudoers_policy_store_result(struct sudoers_context *ctx, bool accepted,
813813

814814
/* Only use results from a group db query, not the front end. */
815815
gidlist = sudo_get_gidlist(ctx->runas.pw, ENTRY_TYPE_QUERIED);
816+
if (gid_list == NULL) {
817+
sudo_gidlist_delref(gidlist);
818+
goto oom;
819+
}
816820

817821
/* We reserve an extra spot in the list for the effective gid. */
818822
glsize = sizeof("runas_groups=") - 1 +

0 commit comments

Comments
 (0)