mirror of
https://git.proxmox.com/git/wasi-libc
synced 2025-08-15 06:47:01 +00:00
move to __builtin_add_overflow
This commit is contained in:
parent
ccfe4bda30
commit
30e5a1fd1f
@ -58,10 +58,9 @@ void *mmap(void *addr, size_t length, int prot, int flags,
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
const size_t buf_len = sizeof(struct map) + length;
|
||||
|
||||
// Check for integer overflow.
|
||||
if(buf_len < length) {
|
||||
size_t buf_len = 0;
|
||||
if(__builtin_add_overflow(length, sizeof(struct map), &buf_len)) {
|
||||
errno = EINVAL;
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user