summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-03 06:54:17 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-03 06:54:17 +0000
commitff6944d6d2d9c41b543bbfba163cfd0b4d44c888 (patch)
tree24926c0efdf5892c76536a5109673836bb933468
parent6bc3fadc19ddf799de891a1c4684128e45b7a629 (diff)
downloadhercules-ff6944d6d2d9c41b543bbfba163cfd0b4d44c888.tar.gz
hercules-ff6944d6d2d9c41b543bbfba163cfd0b4d44c888.tar.bz2
hercules-ff6944d6d2d9c41b543bbfba163cfd0b4d44c888.tar.xz
hercules-ff6944d6d2d9c41b543bbfba163cfd0b4d44c888.zip
bugreport:2638 Fixed exploit which allowed items to be mailed while trading/in-npc/etc. (could cause item dupe on badly scripted npcs). super mega ultra plus master thanks to GM Takumirai.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16369 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/mail.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/map/mail.c b/src/map/mail.c
index b839c3d1f..ce099d0a1 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -59,10 +59,12 @@ int mail_removezeny(struct map_session_data *sd, short flag)
return 1;
}
-unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount)
-{
- if( idx == 0 )
- { // Zeny Transfer
+unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) {
+
+ if( pc_istrading(sd) )
+ return 1;
+
+ if( idx == 0 ) { // Zeny Transfer
if( amount < 0 || !pc_can_give_items(sd) )
return 1;
@@ -72,9 +74,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount)
sd->mail.zeny = amount;
// clif_updatestatus(sd, SP_ZENY);
return 0;
- }
- else
- { // Item Transfer
+ } else { // Item Transfer
idx -= 2;
mail_removeitem(sd, 0);