Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/coreutils/uudecode.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/coreutils/uudecode.c
r3232 r3621 30 30 char *line; 31 31 32 while ((line = xmalloc_fgetline(src_stream)) != NULL) {32 for (;;) { 33 33 int encoded_len, str_len; 34 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 46 if (strcmp(line, "end") == 0) { … … 47 57 encoded_len = line[0] * 4 / 3; 48 58 /* Check that line is not too short. (we tolerate 49 * overly _long_ line to accom odate possible extra '`').59 * overly _long_ line to accommodate possible extra '`'). 50 60 * Empty line case is also caught here. */ 51 61 if (str_len <= encoded_len) { … … 111 121 int mode; 112 122 113 if ( strncmp(line, "begin-base64 ", 13) == 0) {123 if (is_prefixed_with(line, "begin-base64 ")) { 114 124 line_ptr = line + 13; 115 125 decode_fn_ptr = read_base64; 116 } else if ( strncmp(line, "begin ", 6) == 0) {126 } else if (is_prefixed_with(line, "begin ")) { 117 127 line_ptr = line + 6; 118 128 decode_fn_ptr = read_stduu; … … 129 139 break; 130 140 outname++; 141 trim(outname); /* remove trailing space (and '\r' for DOS text) */ 131 142 if (!outname[0]) 132 143 break;
Note:
See TracChangeset
for help on using the changeset viewer.