summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-01-05 12:30:51 +0100
committerJim Meyering <jim@meyering.net>2007-01-05 12:30:51 +0100
commitab58de37e6e01b22acc49f72b109b6e910f5190a (patch)
treec7486de6fb43e4bc9c742fafed1679839000db19
parent4082e3be7cf8c17bf7d8e086798b5f78ba7ea45f (diff)
downloadcoreutils-ab58de37e6e01b22acc49f72b109b6e910f5190a.tar.xz
Avoid a used-uninitialized bug for invalid input, i.e., when the size
of the input, not counting newlines, is 1 % 4. * gl/lib/base64.c (base64_decode): Don't hard-code inlen==4. It may be smaller when flushing.
-rw-r--r--ChangeLog7
-rw-r--r--gl/lib/base64.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 14ab6512d..9c4eb97f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-05 Jim Meyering <jim@meyering.net>
+
+ Avoid a used-uninitialized bug for invalid input, i.e., when the size
+ of the input, not counting newlines, is 1 % 4.
+ * gl/lib/base64.c (base64_decode): Don't hard-code inlen==4.
+ It may be smaller when flushing.
+
2007-01-05 Mike Frysinger <vapier@gentoo.org>
* src/dircolors.hin: Add a TERM directive for cons25.
diff --git a/gl/lib/base64.c b/gl/lib/base64.c
index ba7322a26..a438d0fd1 100644
--- a/gl/lib/base64.c
+++ b/gl/lib/base64.c
@@ -506,7 +506,7 @@ base64_decode (struct base64_decode_context *ctx,
inlen = 0;
break;
}
- if (!decode_4 (non_nl, 4, &out, &outleft))
+ if (!decode_4 (non_nl, inlen, &out, &outleft))
break;
inlen = in_end - in;