mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
estream: Fix unclean usage of realloc.
* common/estream-printf.c (_ESTREAM_PRINTF_MALLOC): Remove. (_ESTREAM_PRINTF_FREE): Remove. (_ESTREAM_PRINTF_REALLOC): New. (fixed_realloc) [!_ESTREAM_PRINTF_REALLOC]): New. (estream_vasprintf): Use my_printf_realloc instead of my_printf_malloc and my_printf_free. (dynamic_buffer_out): Use my_printf_realloc instead of realloc. -- This bug will never happen in current GnuPG/Libgcrypt because we use the standard memory allocation functions via Libgcrypt. However, when used in other environments it would mess up the heap for an asprintf with an output length larger than ~512 bytes.
This commit is contained in:
parent
7589e43b21
commit
e97e2ced6c
4 changed files with 39 additions and 23 deletions
|
@ -24,8 +24,8 @@
|
|||
#include "util.h"
|
||||
#include "iobuf.h"
|
||||
|
||||
#if !defined(_ESTREAM_PRINTF_MALLOC) || !defined(_ESTREAM_PRINTF_FREE)
|
||||
#error Need to define ESTREAM_PRINTF_MALLOC and _FREE
|
||||
#if !defined(_ESTREAM_PRINTF_REALLOC)
|
||||
#error Need to define _ESTREAM_PRINTF_REALLOC
|
||||
#endif
|
||||
|
||||
/* Same as asprintf but return an allocated buffer suitable to be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue