diff options
author | Ron Yorston <rmy@pobox.com> | 2015-10-13 14:45:51 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-10-13 14:45:51 +0100 |
commit | 8e509f11bceeec419abc718300bef7422d1fee4c (patch) | |
tree | fdfbc752ad94102e3613a5d7254f14a93eaf7f56 /coreutils/uudecode.c | |
parent | 420f5edfe7676fe6e7cddbbf15c04649d096e422 (diff) | |
parent | 4d0c1ea4784c9844f8468d97ca5c26d3c70f9921 (diff) | |
download | busybox-w32-8e509f11bceeec419abc718300bef7422d1fee4c.tar.gz busybox-w32-8e509f11bceeec419abc718300bef7422d1fee4c.tar.bz2 busybox-w32-8e509f11bceeec419abc718300bef7422d1fee4c.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'coreutils/uudecode.c')
-rw-r--r-- | coreutils/uudecode.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 7aa5c67f2..37b254d30 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -29,9 +29,19 @@ static void FAST_FUNC read_stduu(FILE *src_stream, FILE *dst_stream, int flags U | |||
29 | { | 29 | { |
30 | char *line; | 30 | char *line; |
31 | 31 | ||
32 | while ((line = xmalloc_fgetline(src_stream)) != NULL) { | 32 | for (;;) { |
33 | int encoded_len, str_len; | 33 | int encoded_len, str_len; |
34 | char *line_ptr, *dst; | 34 | char *line_ptr, *dst; |
35 | size_t line_len; | ||
36 | |||
37 | line_len = 64 * 1024; | ||
38 | line = xmalloc_fgets_str_len(src_stream, "\n", &line_len); | ||
39 | if (!line) | ||
40 | break; | ||
41 | /* Handle both Unix and MSDOS text, and stray trailing spaces */ | ||
42 | str_len = line_len; | ||
43 | while (--str_len >= 0 && isspace(line[str_len])) | ||
44 | line[str_len] = '\0'; | ||
35 | 45 | ||
36 | if (strcmp(line, "end") == 0) { | 46 | if (strcmp(line, "end") == 0) { |
37 | return; /* the only non-error exit */ | 47 | return; /* the only non-error exit */ |
@@ -128,6 +138,7 @@ int uudecode_main(int argc UNUSED_PARAM, char **argv) | |||
128 | if (!outname) | 138 | if (!outname) |
129 | break; | 139 | break; |
130 | outname++; | 140 | outname++; |
141 | trim(outname); /* remove trailing space (and '\r' for DOS text) */ | ||
131 | if (!outname[0]) | 142 | if (!outname[0]) |
132 | break; | 143 | break; |
133 | } | 144 | } |