libselinux: audit2why: clear static variables on init failure
Stephen Smalley
maintainerPATCH 1/1 libselinux: audit2why: clear static variables on init failure
Clear the boollist and avc after freeing them to avoid potential UAF on a subsequent call.
Signed-off-by Stephen Smalley <[email protected]>
--- libselinux/src/audit2why.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
libselinux/src/audit2why.c +3 -2
@@ -275,14 +275,15 @@ static int __policy_init(const char *init_path)return 0 ; err: -if (boollist) -free (boollist); +free (boollist); + boollist =NULL ;if (avc) {if (avc->handle)sepol_handle_destroy (avc->handle);if (avc->policydb)sepol_policydb_free (avc->policydb);free (avc); + avc =NULL ; }if (pf)sepol_policy_file_free (pf);
Signature · 1 line
2.54.0
Quoted 5 lines · Stephen Smalley
Clear the boollist and avc after freeing them to avoid potential UAF on a subsequent call.
Signed-off-by Stephen Smalley <[email protected]>
Acked-by James Carter <[email protected]>
Quoted 29 lines
--- libselinux/src/audit2why.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)libselinux/src/audit2why.c +3
-3@@ -275,14 +275,15 @@ static int __policy_init(const char *init_path)return 0 ; err: -if (boollist) -free (boollist); +free (boollist); + boollist =NULL ;if (avc) {if (avc->handle)sepol_handle_destroy (avc->handle);if (avc->policydb)sepol_policydb_free (avc->policydb);free (avc); + avc =NULL ; }if (pf)sepol_policy_file_free (pf); --2.54.0
Stephen Smalley
maintainerQuoted 10 lines · James Carter
Quoted 5 lines · Stephen Smalley
Clear the boollist and avc after freeing them to avoid potential UAF on a subsequent call.
Signed-off-by Stephen Smalley <[email protected]>Acked-by James Carter <[email protected]>
Merged.
Quoted 30 lines
Quoted 30 lines
--- libselinux/src/audit2why.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)libselinux/src/audit2why.c +3
-3@@ -275,14 +275,15 @@ static int __policy_init(const char *init_path)return 0 ; err: -if (boollist) -free (boollist); +free (boollist); + boollist =NULL ;if (avc) {if (avc->handle)sepol_handle_destroy (avc->handle);if (avc->policydb)sepol_policydb_free (avc->policydb);free (avc); + avc =NULL ; }if (pf)sepol_policy_file_free (pf); --2.54.0