Replace recallocarray() with a realloc() + memset() combo.
authorclaudio <claudio@openbsd.org>
Mon, 26 Aug 2024 13:57:34 +0000 (13:57 +0000)
committerclaudio <claudio@openbsd.org>
Mon, 26 Aug 2024 13:57:34 +0000 (13:57 +0000)
commiteff908c2a43124b0c13a88d8f94abbf6d34a57e0
treebf6613938bafbeefeb86c9335794010d6de33dbc
parent60f67f01e17a7506b9bf1b85b1f57b5e7325a5c2
Replace recallocarray() with a realloc() + memset() combo.

recallocarray(), with its guarantee that memory becoming unallocated is
explicitly discarded, is too slow. In rpki-client forming one particular
ibuf takes more then 4mins because every recallocarray() call ends up
doing a fresh malloc + memcpy + freezero call.
For sensitive data use ibuf_open() instead of ibuf_dynamic() to avoid
any memory reallocations.
OK tb@
lib/libutil/imsg-buffer.c