mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 06:48:05 +01:00
Fix a potentially useless integer overflow check.
GCC 4.2 and maybe other compilers optimize away unsigned integer overflow checks of the form (foo + bar < foo), for all bar. Fix one such check in `src/common/OpenBSD_malloc_Linux.c'.
This commit is contained in:
parent
ac7b6c508d
commit
1ba90ab655
1 changed files with 1 additions and 1 deletions
|
@ -1236,7 +1236,7 @@ imalloc(size_t size)
|
|||
ptralloc = 1;
|
||||
size = malloc_pagesize;
|
||||
}
|
||||
if ((size + malloc_pagesize) < size) { /* Check for overflow */
|
||||
if (size > SIZE_MAX - malloc_pagesize) { /* Check for overflow */
|
||||
result = NULL;
|
||||
errno = ENOMEM;
|
||||
} else if (size <= malloc_maxsize)
|
||||
|
|
Loading…
Add table
Reference in a new issue