Project

General

Profile

Bug #10019 ยป pack.c.patch

wkwood (Will Wood), 07/28/2014 02:47 PM

View differences:

pack.c (working copy)
946 946
static void
947 947
encodes(VALUE str, const char *s, long len, int type, int tail_lf)
948 948
{
949
    enum {buff_size = 4096, encoded_unit = 4};
950
    char buff[buff_size + 1];	/* +1 for tail_lf */
949
    enum {buff_size = 256, encoded_unit = 4};
950
    char buff[buff_size];
951 951
    long i = 0;
952 952
    const char *trans = type == 'u' ? uu_table : b64_table;
953 953
    char padding;
......
968 968
            s += 3;
969 969
            len -= 3;
970 970
        }
971
        if (buff_size-i < encoded_unit) {
971
        if ( ( buff_size-i < encoded_unit ) || len < 3 ) {
972 972
            rb_str_buf_cat(str, buff, i);
973 973
            i = 0;
974 974
        }