selinux/libsemanage
Vit Mojzis 9b4eff9222 libsemanage/direct_api: INTEGER_OVERFLOW read_len = read()
The following statement is always true if read_len is unsigned:
(read_len = read(fd, data_read + data_read_len, max_len - data_read_len)) > 0

Fixes:
 Error: INTEGER_OVERFLOW (CWE-190): [#def19] [important]
 libsemanage-3.7/src/direct_api.c:598:2: tainted_data_return: Called function "read(fd, data_read + data_read_len, max_len - data_read_len)", and a possible return value may be less than zero.
 libsemanage-3.7/src/direct_api.c:598:2: cast_underflow: An assign of a possibly negative number to an unsigned type, which might trigger an underflow.
 libsemanage-3.7/src/direct_api.c:599:3: overflow: The expression "data_read_len += read_len" is deemed underflowed because at least one of its arguments has underflowed.
 libsemanage-3.7/src/direct_api.c:598:2: overflow: The expression "max_len - data_read_len" is deemed underflowed because at least one of its arguments has underflowed.
 libsemanage-3.7/src/direct_api.c:598:2: overflow_sink: "max_len - data_read_len", which might have underflowed, is passed to "read(fd, data_read + data_read_len, max_len - data_read_len)". [Note: The source code implementation of the function has been overridden by a builtin model.]
 \#  596|   	}
 \#  597|
 \#  598|-> 	while ((read_len = read(fd, data_read + data_read_len, max_len - data_read_len)) > 0) {
 \#  599|   		data_read_len += read_len;
 \#  600|   		if (data_read_len == max_len) {

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
Acked-by: James Carter <jwcart2@gmail.com>
2024-10-30 08:17:20 -04:00
..
example
include libsemanage: always write kernel policy when check_ext_changes is specified 2022-06-30 21:09:00 +02:00
man Do not automatically install Russian translations 2023-08-16 13:33:47 -04:00
src libsemanage/direct_api: INTEGER_OVERFLOW read_len = read() 2024-10-30 08:17:20 -04:00
tests libsemanage/tests: use strict prototypes 2023-08-16 13:33:12 -04:00
utils Always use /usr/bin/python3 in Python scripts 2019-02-20 16:43:27 +01:00
.gitignore
LICENSE docs: provide a top level LICENSE file 2022-10-05 08:20:38 -04:00
Makefile
VERSION Release 3.7 2024-06-26 17:30:41 +02:00