From: Fabian Keil Date: Fri, 21 Aug 2015 10:58:53 +0000 (+0000) Subject: execute_external_filter(): Actually fix the buffer scaling X-Git-Tag: v_3_0_24~80 X-Git-Url: http://www.privoxy.org/gitweb/junkmail.html?a=commitdiff_plain;h=e40f4199f733eff6459e4d76929e003f762ce92e;p=privoxy.git 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. --- 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)