Issue information

Issue ID
#2233
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Sep 15, 2008 11:09
Last Post
Hercules Elf Bot
Sep 15, 2008 11:09
Confirmation
N/A

Hercules Elf Bot - Sep 15, 2008 11:09

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=2233

CODE
    for(j = 0; j < MAX_INVENTORY; j++)
        if (char_dat[i].inventory[j].nameid == WEDDING_RING_M || char_dat[i].inventory[j].nameid == WEDDING_RING_F)
            memset(&char_dat[i].inventory[j], 0, sizeof(char_dat[i].inventory[0]));
        if (cs->inventory[j].nameid == WEDDING_RING_M || cs->inventory[j].nameid == WEDDING_RING_F)
            memset(&cs->inventory[j], 0, sizeof(cs->inventory[0]));

This is a case of bad indentation + missing parentheses. What happens here is that the for loop will apply only to the first if statement. The other will perform an out-of-bounds access on inventory[MAX_INVENTORY], and will most likely fail. Thus the partner of the divorcee keeps the ring.