check return value of malloc_read_fd
in case `malloc_read_fd` returns a negative error number, the result would afterwards be casted to an unsigned size_t, and may have theoretically caused an out-of-bounds memory access in the following `strncmp` call.
This commit is contained in:
parent
f80c97e477
commit
856319dc8a
@ -567,6 +567,10 @@ init_thp_state(void) {
|
||||
close(fd);
|
||||
#endif
|
||||
|
||||
if (nread < 0) {
|
||||
goto label_error;
|
||||
}
|
||||
|
||||
if (strncmp(buf, sys_state_madvise, (size_t)nread) == 0) {
|
||||
init_system_thp_mode = thp_mode_default;
|
||||
} else if (strncmp(buf, sys_state_always, (size_t)nread) == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user