libsepol/cil: fix NULL pointer dereference in cil_fill_ipaddr
PATCH 1/1 libsepol/cil: fix NULL pointer dereference in cil_fill_ipaddr
Found a NULL pointer dereference by fuzzing, reproducing:
$ echo "(nodecon(())o(e()))" > tmp.cil
$ secilc tmp.cil
Segmentation fault (core dumped)Add NULL check for addr_node->data in cil_fill_ipaddr.
Signed-off-by lutianxiong <[email protected]>
--- libsepol/cil/src/cil_build_ast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libsepol/cil/src/cil_build_ast.c +1 -1
@@ -5660,7 +5660,7 @@ int cil_fill_ipaddr(struct cil_tree_node *addr_node, struct cil_ipaddr *addr) {int rc =SEPOL_ERR ; -if (addr_node ==NULL || addr ==NULL ) { +if (addr_node ==NULL || addr_node->data ==NULL || addr ==NULL ) { goto exit; }
Signature · 1 line
2.23.0
Quoted 9 lines · lutianxiong
Found a NULL pointer dereference by fuzzing, reproducing:
$ echo "(nodecon(())o(e()))" > tmp.cil $ secilc tmp.cil Segmentation fault (core dumped)Add NULL check for
addr_node->dataincil_fill_ipaddr.Signed-off-by lutianxiong <[email protected]>
Acked-by James Carter <[email protected]>
Quoted 20 lines
--- libsepol/cil/src/cil_build_ast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)libsepol/cil/src/cil_build_ast.c +1
-2@@ -5660,7 +5660,7 @@ int cil_fill_ipaddr(struct cil_tree_node *addr_node, struct cil_ipaddr *addr) {int rc =SEPOL_ERR ; -if (addr_node ==NULL || addr ==NULL ) { +if (addr_node ==NULL || addr_node->data ==NULL || addr ==NULL ) { goto exit; } --2.23.0
Quoted 8 lines · James Carter
Quoted 6 lines · lutianxiong
Found a NULL pointer dereference by fuzzing, reproducing:
$ echo "(nodecon(())o(e()))" > tmp.cil $ secilc tmp.cil Segmentation fault (core dumped)
Quoted 5 lines
Quoted 3 lines
Add NULL check for
addr_node->dataincil_fill_ipaddr.Signed-off-by lutianxiong <[email protected]>Acked-by James Carter <[email protected]>
Merged. Thanks!
Nicolas
Quoted 20 lines
Quoted 20 lines
--- libsepol/cil/src/cil_build_ast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)libsepol/cil/src/cil_build_ast.c +1
-2@@ -5660,7 +5660,7 @@ int cil_fill_ipaddr(struct cil_tree_node *addr_node, struct cil_ipaddr *addr) {int rc =SEPOL_ERR ; -if (addr_node ==NULL || addr ==NULL ) { +if (addr_node ==NULL || addr_node->data ==NULL || addr ==NULL ) { goto exit; } --2.23.0