alpine 3.8
integer weakness #5

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:

irssi-xmpp/src/irssi-xmpp-0.54/src/core/xep/muc-events.c

Context:

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

 
static void
nick_kicked(MUC_REC *channel, const char *nickname, const char *actor,
    const char *reason)
{
	XMPP_NICK_REC *nick;

	if ((nick = xmpp_nicklist_find(channel, nickname)) == NULL)
		return;
	signal_emit("message kick", 6, channel->server, channel->name,
	    nick->nick, (actor != NULL) ? actor : channel->name, nick->host,
	    reason);
	if (channel->ownnick == NICK(nick)) {
		channel->kicked = TRUE;
		channel_destroy(CHANNEL(channel));
	} else
		nicklist_remove(CHANNEL(channel), NICK(nick));
}

static void
error_message(MUC_REC *channel, const char *code)
{
	int error;

	error = code != NULL ? atoi(code) : MUC_ERROR_UNKNOWN;
	switch (error) {
	case MUC_ERROR_PASSWORD_INVALID_OR_MISSING:
		signal_emit("xmpp muc error", 2, channel, "not allowed");
		break;
	}
}

static void
error_join(MUC_REC *channel, const char *code, const char *nick)
{
	char *altnick;
	int error;

	if (nick != NULL && strcmp(nick, channel->nick) != 0)
		return;
	error = code != NULL ? atoi(code) : MUC_ERROR_UNKNOWN;
	signal_emit("xmpp muc joinerror", 2, channel, GINT_TO_POINTER(error));
	switch(error) {
	case MUC_ERROR_USE_RESERVED_ROOM_NICK:
	case MUC_ERROR_NICK_IN_USE:
		/* rejoin with alternate nick */
		altnick = (char *)settings_get_str("alternate_nick");
		if (altnick != NULL && *altnick != '\0'
		    && strcmp(channel->nick, altnick) != 0) {
			g_free(channel->nick); 

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.