aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-11-28 13:39:05 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-11-28 13:43:54 +0100
commitae04ce82cf4352c0d0ecd993b586c10b6b8f80af (patch)
treeaecee3e545d0a8cad4152fc9e06cea95c1f05e85 /libbb
parent885121e25db2ec9a8191a406085d91790a133d20 (diff)
downloadbusybox-w32-ae04ce82cf4352c0d0ecd993b586c10b6b8f80af.tar.gz
busybox-w32-ae04ce82cf4352c0d0ecd993b586c10b6b8f80af.tar.bz2
busybox-w32-ae04ce82cf4352c0d0ecd993b586c10b6b8f80af.zip
base32/64: "truncated base64 input" -> "truncated input"
text data bss dec hex filename 1021739 559 5052 1027350 fad16 busybox_old 1021732 559 5052 1027343 fad0f busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/uuencode.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libbb/uuencode.c b/libbb/uuencode.c
index 6e63bfc6a..21af7a8c9 100644
--- a/libbb/uuencode.c
+++ b/libbb/uuencode.c
@@ -28,7 +28,7 @@ const char bb_uuenc_tbl_base64[] ALIGN1 = {
28 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 28 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
29 'w', 'x', 'y', 'z', '0', '1', '2', '3', 29 'w', 'x', 'y', 'z', '0', '1', '2', '3',
30 '4', '5', '6', '7', '8', '9', '+', '/', 30 '4', '5', '6', '7', '8', '9', '+', '/',
31 '=' /* termination character */, 31 '=' /* termination character */
32}; 32};
33const char bb_uuenc_tbl_std[] ALIGN1 = { 33const char bb_uuenc_tbl_std[] ALIGN1 = {
34 '`', '!', '"', '#', '$', '%', '&', '\'', 34 '`', '!', '"', '#', '$', '%', '&', '\'',
@@ -38,7 +38,7 @@ const char bb_uuenc_tbl_std[] ALIGN1 = {
38 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 38 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
39 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 39 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
40 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 40 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
41 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', 41 'X', 'Y', 'Z', '[', '\\',']', '^', '_',
42 '`' /* termination character */ 42 '`' /* termination character */
43}; 43};
44 44
@@ -82,9 +82,10 @@ void FAST_FUNC bb_uuencode(char *p, const void *src, int length, const char *tbl
82/* 82/*
83 * Decode base64 encoded string. 83 * Decode base64 encoded string.
84 * 84 *
85 * Returns: pointer to the undecoded part of source. 85 * Returns: pointer past the last written output byte,
86 * the result is not NUL-terminated.
87 * (*pp_src) is advanced past the last read byte.
86 * If points to '\0', then the source was fully decoded. 88 * If points to '\0', then the source was fully decoded.
87 * (*pp_dst): advanced past the last written byte.
88 */ 89 */
89char* FAST_FUNC decode_base64(char *dst, const char **pp_src) 90char* FAST_FUNC decode_base64(char *dst, const char **pp_src)
90{ 91{
@@ -131,7 +132,7 @@ char* FAST_FUNC decode_base64(char *dst, const char **pp_src)
131 } 132 }
132 /* i is zero here if full 4-char block was decoded */ 133 /* i is zero here if full 4-char block was decoded */
133 if (pp_src) 134 if (pp_src)
134 *pp_src = src - i; /* -i rejects truncations: e.g. "MQ" and "MQ=" (correct encoding is "MQ==" -> "1") */ 135 *pp_src = src - i; /* -i signals truncation: e.g. "MQ" and "MQ=" (correct encoding is "MQ==" -> "1") */
135 return dst; 136 return dst;
136} 137}
137 138
@@ -265,7 +266,7 @@ void FAST_FUNC read_base64(FILE *src_stream, FILE *dst_stream, int flags)
265 if (*in_tail == '\0') 266 if (*in_tail == '\0')
266 return; 267 return;
267 /* No */ 268 /* No */
268 bb_simple_error_msg_and_die("truncated base64 input"); 269 bb_simple_error_msg_and_die("truncated input");
269 } 270 }
270 271
271 /* It was partial decode */ 272 /* It was partial decode */