]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Correct buffer calculation for snprintf
authorAmos Jeffries <amosjeffries@squid-cache.org>
Sat, 20 Mar 2010 11:04:40 +0000 (05:04 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Sat, 20 Mar 2010 11:04:40 +0000 (05:04 -0600)
lib/rfc1738.c

index f76da407fe4564ba39e9346e1ec5507ee31e9ed1..6158375686ce9807af87b5cbda44be247258e26a 100644 (file)
@@ -133,7 +133,7 @@ rfc1738_do_escape(const char *url, int flags)
          * allocated - KA */
 
         if (do_escape == 1) {
-            (void) snprintf(q, 3, "%%%02X", (unsigned char) *p);
+            (void) snprintf(q, (bufsize-(p-buf)), "%%%02X", (unsigned char) *p);
             q += sizeof(char) * 2;
         } else {
             *q = *p;