Issue information

Issue ID
#4166
Status
Fixed
Severity
Medium
Started
Hercules Elf Bot
Apr 2, 2010 21:15
Last Post
Hercules Elf Bot
Apr 5, 2012 8:32
Confirmation
N/A

Hercules Elf Bot - Apr 2, 2010 21:15

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

We can make a character named ' ' (4 spaces) and another one named ' ' (5 spaces) from the database to reproduce this bug. Once we have created both characters, send any mails whose recipient is empty or contains only spaces (it doesn't matter how many), all the mails will be sent to our ' ' (4 spaces) character, even when we introduce ' ' (5 spaces) which is the name of our second character, mails will still be sent to the 4 spaces one (they are sent to whatever character has less spaces).
I don't know how someone on my server made a character whose nick was ' ' (20 spaces), since you are supposed to get an error message, although maybe this was not always like that (my server is 3 years old), but the point is, sending an email leaving the recipient empty will cause it to be sent to a character whose nick is composed of spaces.

I didn't look further into it, but here is a quick fix:

Inside clif_parse_Mail_send() in clif.c
QUOTE
msg.id = 0; // id will be assigned by charserver
msg.send_id = sd->status.char_id;
msg.dest_id = 0; // will attempt to resolve name
safestrncpy(msg.send_name, sd->status.name, NAME_LENGTH);
safestrncpy(msg.dest_name, (char*)RFIFOP(fd,4), NAME_LENGTH);
safestrncpy(msg.title, (char*)RFIFOP(fd,28), MAIL_TITLE_LENGTH);

if (body_len)
safestrncpy(msg.body, (char*)RFIFOP(fd,69), body_len + 1);
else
memset(msg.body, 0x00, MAIL_BODY_LENGTH);

msg.timestamp = time(NULL);
- if( !intif_Mail_send(sd->status.account_id, &msg) )
+ if( !RFIFOB(fd,4) || !intif_Mail_send(sd->status.account_id, &msg) )
mail_deliveryfail(sd, &msg);

sd->cansendmail_tick = gettick() + 1000; // 1 Second flood Protection
}

Although it doesn't adress the main problem, which is, spaces are not being interpreted right somewhere.

This post has been edited by Kazukin: Apr 3 2010, 03:10 AM

Hercules Elf Bot - Dec 20, 2011 3:43

Originally posted by [b]Ind[/b]
Fixed in [rev=15168]