diff options
author | Werner Koch <[email protected]> | 2012-01-20 13:27:36 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2012-01-20 13:27:36 +0000 |
commit | e97e2ced6cf3ee295a3cc9f8968969a1910380ea (patch) | |
tree | a93dc002b07e86f218886d3a08f06ecece0f09c6 /common/xasprintf.c | |
parent | Do not copy default merge commit log entries into the ChangeLog. (diff) | |
download | gnupg-e97e2ced6cf3ee295a3cc9f8968969a1910380ea.tar.gz gnupg-e97e2ced6cf3ee295a3cc9f8968969a1910380ea.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | common/xasprintf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/xasprintf.c b/common/xasprintf.c index f16410dbd..a403c7b7c 100644 --- a/common/xasprintf.c +++ b/common/xasprintf.c @@ -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 |