aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-12-06 21:39:48 +0000
committerEric Andersen <andersen@codepoet.org>2002-12-06 21:39:48 +0000
commitb077c9f47d276ba32b187883958bb90a64dccdf4 (patch)
tree22d84acbca71eb99560ffde6ecdad3ca1660630d
parentda15a496e239428733be9b20b5ce98ab68d94b04 (diff)
downloadbusybox-w32-b077c9f47d276ba32b187883958bb90a64dccdf4.tar.gz
busybox-w32-b077c9f47d276ba32b187883958bb90a64dccdf4.tar.bz2
busybox-w32-b077c9f47d276ba32b187883958bb90a64dccdf4.zip
Fixup buffer allocation
-rw-r--r--coreutils/uuencode.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c
index 1d42494fd..49b2d9189 100644
--- a/coreutils/uuencode.c
+++ b/coreutils/uuencode.c
@@ -83,19 +83,21 @@ static void uuencode (const char *s, const char *store, const int length, const
83 *p = '\0'; 83 *p = '\0';
84} 84}
85 85
86#define SRC_BUF_SIZE 45 // This *MUST* be a multiple of 3
87#define DST_BUF_SIZE 4 * ((SRC_BUF_SIZE + 2) / 3)
86int uuencode_main(int argc, char **argv) 88int uuencode_main(int argc, char **argv)
87{ 89{
88 const int src_buf_size = 45;// This *MUST* be a multiple of 3 90 const int src_buf_size = SRC_BUF_SIZE;
89 const int dst_buf_size = 4 * ((src_buf_size + 2) / 3); 91 const int dst_buf_size = DST_BUF_SIZE;
90 int write_size = dst_buf_size; 92 int write_size = dst_buf_size;
91 RESERVE_CONFIG_BUFFER(src_buf, src_buf_size + 1);
92 RESERVE_CONFIG_BUFFER(dst_buf, dst_buf_size + 1);
93 struct stat stat_buf; 93 struct stat stat_buf;
94 FILE *src_stream = stdin; 94 FILE *src_stream = stdin;
95 char *tbl = tbl_std; 95 char *tbl = tbl_std;
96 size_t size; 96 size_t size;
97 mode_t mode; 97 mode_t mode;
98 int opt; 98 int opt;
99 RESERVE_CONFIG_BUFFER(src_buf, SRC_BUF_SIZE + 1);
100 RESERVE_CONFIG_BUFFER(dst_buf, DST_BUF_SIZE + 1);
99 101
100 while ((opt = getopt(argc, argv, "m")) != -1) { 102 while ((opt = getopt(argc, argv, "m")) != -1) {
101 switch (opt) { 103 switch (opt) {