Skip to content

Commit e8ab76f

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 07e2bdc commit e8ab76f

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
@@ -3845,6 +3845,10 @@ static int blocks_to_cil(struct policydb *pdb)
38453845
}
38463846

38473847
block = pdb->global;
3848+
if (!block) {
3849+
goto exit;
3850+
}
3851+
38483852
rc = global_block_to_cil(pdb, block, stack);
38493853
if (rc != 0) {
38503854
goto exit;

0 commit comments

Comments
 (0)