diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-09-03 16:56:05 -0400 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2020-09-03 23:10:00 +0200 |
commit | 40c190dc1f6630054d7d2f850a0b9fb10c7bbcb1 (patch) | |
tree | a0e065eab9d58c9636fda6dfce794cbfcff69fb8 | |
parent | cad5d69545765e00715d0cb0c88a3b4c20a59c1e (diff) | |
download | acl-40c190dc1f6630054d7d2f850a0b9fb10c7bbcb1.tar.gz |
acl_from_mode, acl_copy_int: Fix segfault on allocation failure
__acl_free_acl_obj() is unprepared for NULL, so just return immediately
instead of trying to free a NULL obj.
Signed-off-by: Tavian Barnes <tavianator@tavianator.com>
[Fix the same bug in acl_copy_int.]
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
-rw-r--r-- | libacl/acl_copy_int.c | 3 | ||||
-rw-r--r-- | libacl/acl_from_mode.c | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/libacl/acl_copy_int.c b/libacl/acl_copy_int.c index bcbacf1..f0b6f30 100644 --- a/libacl/acl_copy_int.c +++ b/libacl/acl_copy_int.c @@ -47,7 +47,7 @@ acl_copy_int(const void *buf_p) entries = size / sizeof(struct __acl_entry); acl_obj_p = __acl_init_obj(entries); if (acl_obj_p == NULL) - goto fail; + return NULL; end_p = ext_acl->x_entries + entries; for(; ent_p != end_p; ent_p++) { entry_obj_p = __acl_create_entry_obj(acl_obj_p); @@ -64,4 +64,3 @@ fail: __acl_free_acl_obj(acl_obj_p); return NULL; } - diff --git a/libacl/acl_from_mode.c b/libacl/acl_from_mode.c index c6999e3..cda661d 100644 --- a/libacl/acl_from_mode.c +++ b/libacl/acl_from_mode.c @@ -42,7 +42,7 @@ acl_from_mode(mode_t mode) acl_obj_p = __acl_init_obj(3); if (!acl_obj_p) - goto fail; + return NULL; entry_obj_p = __acl_create_entry_obj(acl_obj_p); if (!entry_obj_p) |