Fix double-free in secilcheck
PATCH 1/1 Fix double-free in secilcheck
If the file size of the cil file is zero, fclose was called twice.
Fixes:
``` localhost:~ # touch ~/.empty.cil localhost:~ # secilcheck /etc/selinux/targeted/policy/policy.35 ./empty.cil free(): double free detected in tcache 2 Aborted (core dumped) secilcheck /etc/selinux/targeted/policy/policy.35 ./empty.cil ```
Signed-off-by Cathy Hu <[email protected]>
--- secilc/secilcheck.c | 1 - 1 file changed, 1 deletion(-)
secilc/secilcheck.c +0 -1
@@ -155,7 +155,6 @@ static int add_cil_file(const char *filename, struct cil_db *cdb) file_size = filedata.st_size;if (!file_size) { -fclose (file); rc =0 ; goto exit; }
Signature · 1 line
2.54.0
Quoted 4 lines · Cathy Hu
If the file size of the cil file is zero, fclose was called twice.
Fixes:
Quoted 8 lines
``` localhost:~ # touch ~/.empty.cil localhost:~ # secilcheck /etc/selinux/targeted/policy/policy.35 ./empty.cil free(): double free detected in tcache 2 Aborted (core dumped) secilcheck /etc/selinux/targeted/policy/policy.35 ./empty.cil ```Signed-off-by Cathy Hu <[email protected]>
Acked-by James Carter <[email protected]>
Quoted 20 lines
--- secilc/secilcheck.c | 1 - 1 file changed, 1 deletion(-)secilc/secilcheck.c +0
-2@@ -155,7 +155,6 @@ static int add_cil_file(const char *filename, struct cil_db *cdb) file_size = filedata.st_size;if (!file_size) { -fclose (file); rc =0 ; goto exit; } --2.54.0
Stephen Smalley
maintainerQuoted 13 lines · James Carter
Quoted 11 lines · Cathy Hu
If the file size of the cil file is zero, fclose was called twice.
Fixes:
``` localhost:~ # touch ~/.empty.cil localhost:~ # secilcheck /etc/selinux/targeted/policy/policy.35 ./empty.cil free(): double free detected in tcache 2 Aborted (core dumped) secilcheck /etc/selinux/targeted/policy/policy.35 ./empty.cil ```
Quoted 3 lines
Quoted 1 line
Signed-off-by Cathy Hu <[email protected]>Acked-by James Carter <[email protected]>
Thanks, merged.
Quoted 22 lines
Quoted 21 lines
--- secilc/secilcheck.c | 1 - 1 file changed, 1 deletion(-)secilc/secilcheck.c +0
-2@@ -155,7 +155,6 @@ static int add_cil_file(const char *filename, struct cil_db *cdb) file_size = filedata.st_size;if (!file_size) { -fclose (file); rc =0 ; goto exit; } --2.54.0