Skip to content

Commit 26005d7

Browse files
committed
[WIP] libsepol: do not dump pdb->global block if it is NULL
TODO: does it make sense to have a policy with ->global=NULL? gdb session: Program received signal SIGSEGV, Segmentation fault. blocks_to_cil (pdb=0x6042e0) at module_to_cil.c:3760 3760 rc = global_block_to_cil(pdb, block, stack); (gdb) bt #0 blocks_to_cil (pdb=0x6042e0) at module_to_cil.c:3760 SELinuxProject#1 sepol_module_policydb_to_cil (fp=fp@entry=0x7ffff79d05e0 <_IO_2_1_stdout_>, pdb=0x6042e0, linked=linked@entry=0) at module_to_cil.c:4047 SELinuxProject#2 0x00007ffff7a86ac5 in sepol_module_package_to_cil (fp=fp@entry=0x7ffff79d05e0 <_IO_2_1_stdout_>, mod_pkg=0x604280) at module_to_cil.c:4076 SELinuxProject#3 0x0000000000401acc in main (argc=<optimized out>, argv=<optimized out>) at pp.c:150 (gdb) p pdb->global $1 = (avrule_block_t *) 0x0 Signed-off-by: Nicolas Iooss <[email protected]>
1 parent fb49c6c commit 26005d7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libsepol/src/module_to_cil.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3836,6 +3836,10 @@ static int blocks_to_cil(struct policydb *pdb)
38363836
}
38373837

38383838
block = pdb->global;
3839+
if (!block) {
3840+
goto exit;
3841+
}
3842+
38393843
rc = global_block_to_cil(pdb, block, stack);
38403844
if (rc != 0) {
38413845
goto exit;

0 commit comments

Comments
 (0)