NTP BUG 3385: ereallocarray() / eallocarray() underused

Last update: June 27, 2022 20:45 UTC (51d68a4aa)


Resolved 4.2.8p10 21 Mar 2017
References Bug 3385
Affects All versions of NTP, up to but not including ntp-4.2.8p10, and ntp-4.3.0 up to, but not including ntp-4.3.94. Resolved in 4.2.8p10.


NTP makes use of several wrappers around the standard heap memory allocation functions that are provided by libc. This is mainly done to introduce additional safety checks concentrated on several goals. First, they seek to ensure that memory is not accidentally freed, secondly they verify that a correct amount is always allocated and, thirdly, that allocation failures are correctly handled. There is an additional implementation for scenarios where memory for a specific amount of items of the same size needs to be allocated. The handling can be found in the oreallocarray() function for which a further number-of-elements parameter needs to be provided. Although no considerable threat was identified as tied to a lack of use of this function, it is recommended to correctly apply oreallocarray() as a preferred option across all of the locations where it is possible.



This weakness was discovered by Cure53.