[tor-bugs] #12855 [Tor]: Use calloc and reallocarray instead of malloc(a*b), malloc_zero(a*b), or realloc(p, a*b)
Tor Bug Tracker & Wiki
blackhole at torproject.org
Wed Aug 13 14:28:24 UTC 2014
#12855: Use calloc and reallocarray instead of malloc(a*b), malloc_zero(a*b), or
realloc(p,a*b)
-----------------------+------------------------------------
Reporter: nickm | Owner:
Type: defect | Status: new
Priority: normal | Milestone: Tor: 0.2.6.x-final
Component: Tor | Version:
Keywords: tor-relay | Actual Points:
Parent ID: | Points:
-----------------------+------------------------------------
It's stupid and error-prone to multiply-then-malloc: you're just begging
for an integer overflow. We should add a reallocarray (like OpenBSD uses)
and use spatch/coccinelle to replace all our bad allocations.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12855>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list