diff options
author | Simon Josefsson <simon@josefsson.org> | 2006-03-24 12:36:06 +0000 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2006-03-24 12:36:06 +0000 |
commit | e12ea14e1cf90b6efcbe644c0f019dc434f09481 (patch) | |
tree | 9bfaf7d6a422bcfa30492d6af9ea178c0abefc48 | |
parent | 9f77158ba81506317b18945813cebcdafbb249a6 (diff) | |
download | gnulib-e12ea14e1cf90b6efcbe644c0f019dc434f09481.tar.gz |
2006-03-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* base64.c (base64_encode): Do not read past end of array with
unsanitized input on systems with CHAR_BIT > 8.
-rw-r--r-- | lib/ChangeLog | 5 | ||||
-rw-r--r-- | lib/base64.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index fed0610a72..75a0866a07 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2006-03-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + * base64.c (base64_encode): Do not read past end of array with + unsanitized input on systems with CHAR_BIT > 8. + 2006-03-16 Paul Eggert <eggert@cs.ucla.edu> * regex.h (regoff_t) [defined _REGEX_LARGE_OFFSETS]: diff --git a/lib/base64.c b/lib/base64.c index 7682f859d3..1fe719c95c 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -74,7 +74,7 @@ base64_encode (const char *restrict in, size_t inlen, while (inlen && outlen) { - *out++ = b64str[to_uchar (in[0]) >> 2]; + *out++ = b64str[(to_uchar (in[0]) >> 2) & 0x3f]; if (!--outlen) break; *out++ = b64str[((to_uchar (in[0]) << 4) |