aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Eric Andersen <andersen@codepoet.org>2002-12-06 21:39:48 +0000
committerGravatar Eric Andersen <andersen@codepoet.org>2002-12-06 21:39:48 +0000
commitb077c9f47d276ba32b187883958bb90a64dccdf4 (patch)
tree22d84acbca71eb99560ffde6ecdad3ca1660630d
parentda15a496e239428733be9b20b5ce98ab68d94b04 (diff)
downloadbusybox-b077c9f47d276ba32b187883958bb90a64dccdf4.tar.gz
busybox-b077c9f47d276ba32b187883958bb90a64dccdf4.tar.bz2
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
*p = '\0';
}
+#define SRC_BUF_SIZE 45 // This *MUST* be a multiple of 3
+#define DST_BUF_SIZE 4 * ((SRC_BUF_SIZE + 2) / 3)
int uuencode_main(int argc, char **argv)
{
- const int src_buf_size = 45;// This *MUST* be a multiple of 3
- const int dst_buf_size = 4 * ((src_buf_size + 2) / 3);
+ const int src_buf_size = SRC_BUF_SIZE;
+ const int dst_buf_size = DST_BUF_SIZE;
int write_size = dst_buf_size;
- RESERVE_CONFIG_BUFFER(src_buf, src_buf_size + 1);
- RESERVE_CONFIG_BUFFER(dst_buf, dst_buf_size + 1);
struct stat stat_buf;
FILE *src_stream = stdin;
char *tbl = tbl_std;
size_t size;
mode_t mode;
int opt;
+ RESERVE_CONFIG_BUFFER(src_buf, SRC_BUF_SIZE + 1);
+ RESERVE_CONFIG_BUFFER(dst_buf, DST_BUF_SIZE + 1);
while ((opt = getopt(argc, argv, "m")) != -1) {
switch (opt) {