From: Fabian Keil <fk@fabiankeil.de>
Date: Thu, 23 Jun 2011 13:57:47 +0000 (+0000)
Subject: In decompress_iob() change a buffer limit check from '==' to the '>=' one would expec... 
X-Git-Tag: v_3_0_18~217
X-Git-Url: http://www.privoxy.org/gitweb/@default-cgi@/faq/%22https:/developer-manual/@user-manual@actions-file.html?a=commitdiff_plain;h=f7b5dc65ad09236147cd10027921c7a652d6ccbe;p=privoxy.git

In decompress_iob() change a buffer limit check from '==' to the '>=' one would expect at first glance.

At the same time explain why we don't really have to.
---

diff --git a/parsers.c b/parsers.c
index e7a22e24..11845600 100644
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.221 2011/03/27 14:01:46 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.222 2011/04/19 13:00:47 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
@@ -619,10 +619,12 @@ jb_err decompress_iob(struct client_state *csp)
       }
 
       /*
-       * If we tried the limit and still didn't have enough
-       * memory, just give up.
+       * If we reached the buffer limit and still didn't have enough
+       * memory, just give up. Due to the ceiling enforced by the next
+       * if block we could actually check for equality here, but as it
+       * can be easily mistaken for a bug we don't.
        */
-      if (bufsize == csp->config->buffer_limit)
+      if (bufsize >= csp->config->buffer_limit)
       {
          log_error(LOG_LEVEL_ERROR, "Buffer limit reached while decompressing iob");
          return JB_ERR_MEMORY;