libsepol: return failure on saturated class name length
PATCH 1/1 libsepol: return failure on saturated class name length
Do not return success if the class name length is saturated (or too big in the fuzzer build).
Fixes c3d52a6a ("libsepol: check for saturated class name length")
Signed-off-by Christian Göttsche <[email protected]>
--- libsepol/src/policydb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
libsepol/src/policydb.c +3 -1
@@ -3937,7 +3937,9 @@ static int scope_index_read(scope_index_t * scope_index,if (rc <0 )return -1 ; scope_index->class_perms_len =le32_to_cpu (buf[0 ]); -if (zero_or_saturated (scope_index->class_perms_len)) { +if (is_saturated (scope_index->class_perms_len)) +return -1 ; +if (scope_index->class_perms_len ==0 ) { scope_index->class_perms_map =NULL ;return 0 ; }
Signature · 1 line
2.34.1
Quoted 7 lines · Christian Göttsche
Do not return success if the class name length is saturated (or too big in the fuzzer build).
Fixes c3d52a6a ("libsepol: check for saturated class name length")Signed-off-by Christian Göttsche <[email protected]>
Acked-by James Carter <[email protected]>
Quoted 22 lines
--- libsepol/src/policydb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)libsepol/src/policydb.c +3
-2@@ -3937,7 +3937,9 @@ static int scope_index_read(scope_index_t * scope_index,if (rc <0 )return -1 ; scope_index->class_perms_len =le32_to_cpu (buf[0 ]); -if (zero_or_saturated (scope_index->class_perms_len)) { +if (is_saturated (scope_index->class_perms_len)) +return -1 ; +if (scope_index->class_perms_len ==0 ) { scope_index->class_perms_map =NULL ;return 0 ; } --2.34.1
Quoted 4 lines · James Carter
Quoted 1 line · Christian Göttsche
Quoted 9 lines
Quoted 6 lines
Do not return success if the class name length is saturated (or too big in the fuzzer build).
Fixes c3d52a6a ("libsepol: check for saturated class name length")Signed-off-by Christian Göttsche <[email protected]>Acked-by James Carter <[email protected]>
Merged.
Thanks,
Jim
Quoted 22 lines
Quoted 22 lines
--- libsepol/src/policydb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)libsepol/src/policydb.c +3
-2@@ -3937,7 +3937,9 @@ static int scope_index_read(scope_index_t * scope_index,if (rc <0 )return -1 ; scope_index->class_perms_len =le32_to_cpu (buf[0 ]); -if (zero_or_saturated (scope_index->class_perms_len)) { +if (is_saturated (scope_index->class_perms_len)) +return -1 ; +if (scope_index->class_perms_len ==0 ) { scope_index->class_perms_map =NULL ;return 0 ; } --2.34.1