Howdy,
base64.c:from64tobits only checks every third character to
determine if it would overflow the output buffer. With the
following patch, it will check for every character.
Matt
--- fetchmail-5.9.10/base64.c Wed Oct 3 02:37:33 2001
+++ fetchmail/base64.c Mon Mar 25 13:32:42 2002
@@ -83,12 +83,16 @@ int from64tobits(char *out, const char *
*out++ = (DECODE64(digit1) << 2) | (DECODE64(digit2) >> 4);
if (digit3 != '=')
{
- *out++ = ((DECODE64(digit2) << 4) & 0xf0) | (DECODE64(digit3) >> 2);
++len;
+ if (len >= maxlen)
+ return(-1);
+ *out++ = ((DECODE64(digit2) << 4) & 0xf0) | (DECODE64(digit3) >> 2);
if (digit4 != '=')
{
+ ++len;
+ if (len >= maxlen)
+ return(-1);
*out++ = ((DECODE64(digit3) << 6) & 0xc0) | DECODE64(digit4);
- ++len;
}
}
} while
pgp5ZZ8ZWQl4o.pgp
Description: PGP signature