From: Amos Jeffries Date: Sat, 20 Mar 2010 11:04:40 +0000 (-0600) Subject: Correct buffer calculation for snprintf X-Git-Tag: SQUID_3_2_0_1~346 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc63048221c467b6a70d969092dceb63ee1dff27;p=thirdparty%2Fsquid.git Correct buffer calculation for snprintf --- diff --git a/lib/rfc1738.c b/lib/rfc1738.c index f76da407fe..6158375686 100644 --- a/lib/rfc1738.c +++ b/lib/rfc1738.c @@ -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;