diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-10 17:03:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-10 17:10:31 +0300 |
commit | 8fc98e3906f38b25c71b60b26bb31d0027ee02a0 (patch) | |
tree | ddc6cdaf9ff81c01033e3d390c40ce0432edafaf /src/map/mail.c | |
parent | c76aa5f4843a521b1839875bf6c139f4658bd6d1 (diff) | |
download | hercules-8fc98e3906f38b25c71b60b26bb31d0027ee02a0.tar.gz hercules-8fc98e3906f38b25c71b60b26bb31d0027ee02a0.tar.bz2 hercules-8fc98e3906f38b25c71b60b26bb31d0027ee02a0.tar.xz hercules-8fc98e3906f38b25c71b60b26bb31d0027ee02a0.zip |
Add extra checks into mail system.
Diffstat (limited to 'src/map/mail.c')
-rw-r--r-- | src/map/mail.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/map/mail.c b/src/map/mail.c index 0bdad2877..8acfbdcb9 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -83,7 +83,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) { if( idx < 0 || idx >= MAX_INVENTORY ) return 1; - if( amount < 0 || amount > sd->status.inventory[idx].amount ) + if( amount <= 0 || amount > sd->status.inventory[idx].amount ) return 1; if( !pc_can_give_items(sd) || sd->status.inventory[idx].expire_time || !itemdb_canmail(&sd->status.inventory[idx],pc_get_group_level(sd)) || @@ -122,6 +122,8 @@ bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg) memcpy(&msg->item, &sd->status.inventory[n], sizeof(struct item)); msg->item.amount = sd->mail.amount; + if (msg->item.amount != sd->mail.amount) // check for amount overflow + return false; } else memset(&msg->item, 0x00, sizeof(struct item)); |