From e40f4199f733eff6459e4d76929e003f762ce92e Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Fri, 21 Aug 2015 10:58:53 +0000 Subject: [PATCH] execute_external_filter(): Actually fix the buffer scaling The previous commit was about as wrong as the code it "fixed" and could still result in a buffer that wasn't large enough to hold all the output from the external filter. Submitted by Yang Xia in #892. --- filters.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filters.c b/filters.c index d3dcaeb3..6b25fc52 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.192 2014/10/18 11:30:24 fabiankeil Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.193 2015/08/12 10:34:21 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -1886,7 +1886,7 @@ static char *execute_external_filter(const struct client_state *csp, char *p; /* Could be considered wasteful if the content is 'large'. */ - *size = (*size > READ_LENGTH) ? *size * 2 : READ_LENGTH; + *size += (*size >= READ_LENGTH) ? *size : READ_LENGTH; p = realloc(filter_output, *size); if (p == NULL) -- 2.39.2