Message ID | 20250115131329.132477-1-cgoettsche@seltendoof.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/5] libselinux: set errno in failure case | expand |
diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c index 2f811b67..96a481f7 100644 --- a/checkpolicy/policy_define.c +++ b/checkpolicy/policy_define.c @@ -4437,6 +4437,7 @@ static int parse_semantic_categories(char *id, level_datum_t * levdatum __attrib int define_user(void) { + const char *username; char *id; user_datum_t *usrdatum, *usr_global; level_datum_t *levdatum; @@ -4463,7 +4464,13 @@ int define_user(void) return 0; } - id = strdup(queue_head(id_queue)); + username = queue_head(id_queue); + if (!username) { + yyerror("no user name"); + return -1; + } + + id = strdup(username); if ((usrdatum = declare_user()) == NULL) { free(id);