alpine 3.9
integer weakness #27


Weakness Breakdown


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:



The highlighted line of code below is the trigger point of this particular Alpine 3.9 integer weakness.

     case 'V':

    case O_BLOCK_ON_SUBNETS:		block_on_subnets = get_bool(name, val);			break;
    case O_CHARSET_DEFAULT:		charset_default = get_string(name, val);		break;
    case O_HEADER_FORMAT:		header_format = get_string(name, val);			break;
    case O_LOG_HEADER_FORMAT:		log_header_format = get_string(name, val);		break;
    case O_LOG_UPDATE_FORMAT:		log_update_format = get_string(name, val);		break;
    case O_MAX_TOKEN_LEN:		max_token_len=atoi(val);				break;
    case O_MIN_TOKEN_LEN:		min_token_len=atoi(val);				break;
    case O_MAX_MULTI_TOKEN_LEN:		max_multi_token_len=atoi(val);				break;
    case O_MULTI_TOKEN_COUNT:		multi_token_count=atoi(val);				break;
    case O_REPLACE_NONASCII_CHARACTERS:	replace_nonascii_characters = get_bool(name, val);	break;
    case O_SPAMICITY_FORMATS:		set_spamicity_formats(val);				break;
    case O_SPAMICITY_TAGS:		set_spamicity_tags(val);				break;
    case O_SPAM_HEADER_NAME:		spam_header_name = get_string(name, val);		break;
    case O_SPAM_HEADER_PLACE:		spam_header_place = get_string(name, val);		break;
    case O_SPAM_SUBJECT_TAG:		spam_subject_tag = get_string(name, val);		break;
    case O_STATS_IN_HEADER:		stats_in_header = get_bool(name, val);			break;
    case O_TERSE:			terse = get_bool(name, val);				break;
    case O_TERSE_FORMAT:		terse_format = get_string(name, val);			break;
    case O_THRESH_UPDATE:		get_double(name, val, &thresh_update);			break;
    case O_TIMESTAMP:			timestamp_tokens = get_bool(name, val);			break;
    case O_TOKEN_COUNT_FIX:             token_count_fix = atoi(val);                            break;
    case O_TOKEN_COUNT_MIN:             token_count_min = atoi(val);                            break;
    case O_TOKEN_COUNT_MAX:             token_count_max = atoi(val);                            break;
    case O_UNSURE_SUBJECT_TAG:		unsure_subject_tag = get_string(name, val);		break;
    case O_UNICODE:			encoding = get_bool(name, val) ? E_UNICODE : E_RAW;	break;
    case O_WORDLIST:			configure_wordlist(val);				break;

    case O_DB_TRANSACTION:		eTransaction = get_txn(name, val);			break;

	if (!dsm_options_bogofilter(option, name, val))
	    fprintf(stderr, "Invalid option '%s'.\n", name);

    return 0;

#define	Q1	if (query >= 1)
#define	Q2	if (query >= 2)
#define	Q3	if (query >= 3)

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.