fedora 25
integer weakness #21

2

Weakness Breakdown


Definition:

An integer overflow occurs when the answer to an arithmetic operation exceeds the maximum size of the integer type used to store it. The resulting value will appear to have wrapped around the maximum value and started again at the minimum value. This would look like a clock that represents 13:00 by pointing at 1:00. An attacker can use an integer overflow during a buffer length calculation, which results in the allocated buffer being too small to hold the data copied into it, thus causing a buffer overflow.

Warning code(s):

Unless checked, the resulting number can exceed the expected range.

File Name:

bogofilter-1.2.4/src/msgcounts.c

Context:

The highlighted line of code below is the trigger point of this particular Fedora 25 integer weakness.

 	saved = false;
	if (msg_sep)
	    return MSG_COUNT_LINE;
	else
	    return BOGO_LEX_LINE;
    }
}

bool msgcount_more(void)
{
    bool val = saved;
    saved = false;
    return val;
}

void set_msg_counts(u_int32_t good, u_int32_t spam)
{
    msgs_bad = spam;
    msgs_good = good;
}

void set_msg_counts_from_str(char *str)
{
    uint b, g;
    b = atoi(str);
    str = strchr(str, ' ') + 1;
    g = atoi(str);

    set_msg_counts(g, b);

    msg_count_header_len= strlen(msg_count_header);
}

long msg_count_get_token(byte **output)
{
    *output = (byte *)msg_count_text;
    return msg_count_leng;
} 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.