From e97e2ced6cf3ee295a3cc9f8968969a1910380ea Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 20 Jan 2012 14:27:36 +0100 Subject: 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. --- configure.ac | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 9dd555ea7..ab847af09 100644 --- a/configure.ac +++ b/configure.ac @@ -511,8 +511,7 @@ AH_BOTTOM([ /* We want to use the libgcrypt provided memory allocation for asprintf. */ -#define _ESTREAM_PRINTF_MALLOC gcry_malloc -#define _ESTREAM_PRINTF_FREE gcry_free +#define _ESTREAM_PRINTF_REALLOC gcry_realloc #define _ESTREAM_PRINTF_EXTRA_INCLUDE "../common/util.h" /* Under Windows we use the gettext code from libgpg-error. */ -- cgit v1.2.3