Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/coreutils/uudecode.c

    r3232 r3621  
    3030    char *line;
    3131
    32     while ((line = xmalloc_fgetline(src_stream)) != NULL) {
     32    for (;;) {
    3333        int encoded_len, str_len;
    3434        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';
    3545
    3646        if (strcmp(line, "end") == 0) {
     
    4757        encoded_len = line[0] * 4 / 3;
    4858        /* Check that line is not too short. (we tolerate
    49          * overly _long_ line to accomodate possible extra '`').
     59         * overly _long_ line to accommodate possible extra '`').
    5060         * Empty line case is also caught here. */
    5161        if (str_len <= encoded_len) {
     
    111121        int mode;
    112122
    113         if (strncmp(line, "begin-base64 ", 13) == 0) {
     123        if (is_prefixed_with(line, "begin-base64 ")) {
    114124            line_ptr = line + 13;
    115125            decode_fn_ptr = read_base64;
    116         } else if (strncmp(line, "begin ", 6) == 0) {
     126        } else if (is_prefixed_with(line, "begin ")) {
    117127            line_ptr = line + 6;
    118128            decode_fn_ptr = read_stduu;
     
    129139                break;
    130140            outname++;
     141            trim(outname); /* remove trailing space (and '\r' for DOS text) */
    131142            if (!outname[0])
    132143                break;
Note: See TracChangeset for help on using the changeset viewer.