summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-09-06 00:05:37 +0200
committerGitHub <noreply@github.com>2017-09-06 00:05:37 +0200
commitd8a0c96fb31af1d5e41705d159cea430d2e3af5d (patch)
treeed339d49a62b7a7f9296746096e848256d7c4cb2
parent798e0cd22aaa573565005a9e80a1ad5553b7c2b3 (diff)
parentcb2924a3d4cf138587daff750b5278e9d30975e6 (diff)
downloadhercules-d8a0c96fb31af1d5e41705d159cea430d2e3af5d.tar.gz
hercules-d8a0c96fb31af1d5e41705d159cea430d2e3af5d.tar.bz2
hercules-d8a0c96fb31af1d5e41705d159cea430d2e3af5d.tar.xz
hercules-d8a0c96fb31af1d5e41705d159cea430d2e3af5d.zip
Merge pull request #1822 from 4144/rodexfix
fix crash, exploits and adjust rodex packet versions based on tests.
-rw-r--r--db/constants.conf2
-rw-r--r--db/sc_config.txt2
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/rodex.c31
4 files changed, 31 insertions, 6 deletions
diff --git a/db/constants.conf b/db/constants.conf
index dd280612c..d4f6c8f0d 100644
--- a/db/constants.conf
+++ b/db/constants.conf
@@ -1395,6 +1395,8 @@ constants_db: {
SC_SHRIMP: 650
SC_FRESHSHRIMP: 651
+ SC_DAILYSENDMAILCNT: 653
+
// Summer 2 Costume
SC_DRESS_UP: 652
diff --git a/db/sc_config.txt b/db/sc_config.txt
index 661e9bb87..797a2578b 100644
--- a/db/sc_config.txt
+++ b/db/sc_config.txt
@@ -498,3 +498,5 @@ SC_BITESCAR, 4
// Cant Clear
SC_ALL_RIDING, 397
+
+SC_DAILYSENDMAILCNT, 461
diff --git a/src/map/clif.c b/src/map/clif.c
index 28b20c9e2..1731e88ca 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -19679,7 +19679,7 @@ void clif_rodex_request_items(struct map_session_data *sd, int8 opentype, int64
void clif_rodex_icon(int fd, bool show)
{
// packet add date is 20140716, but from players reports it wrong. Using closer known correct version.
-#if PACKETVER >= 20150513
+#if PACKETVER >= 20141112
WFIFOHEAD(fd, 3);
WFIFOW(fd, 0) = rodexicon;
WFIFOB(fd, 2) = (show == true ? 1 : 0);
diff --git a/src/map/rodex.c b/src/map/rodex.c
index c041ecc6b..63d7242db 100644
--- a/src/map/rodex.c
+++ b/src/map/rodex.c
@@ -263,17 +263,38 @@ int rodex_send_mail(struct map_session_data *sd, const char *receiver_name, cons
for (i = 0; i < RODEX_MAX_ITEM; i++) {
int16 idx = sd->rodex.tmp.items[i].idx;
+ int j;
+ struct item *tmpItem = &sd->rodex.tmp.items[i].item;
+ struct item *invItem = &sd->status.inventory[idx];
- if (sd->rodex.tmp.items[i].item.nameid == 0)
+ if (tmpItem->nameid == 0)
continue;
- if (sd->rodex.tmp.items[i].item.nameid != sd->status.inventory[idx].nameid
- || sd->rodex.tmp.items[i].item.unique_id != sd->status.inventory[idx].unique_id
- || sd->rodex.tmp.items[i].item.amount > sd->status.inventory[idx].amount
- || sd->rodex.tmp.items[i].item.amount < 1) {
+ if (tmpItem->nameid != invItem->nameid ||
+ tmpItem->unique_id != invItem->unique_id ||
+ tmpItem->refine != invItem->refine ||
+ tmpItem->attribute != invItem->attribute ||
+ tmpItem->expire_time != invItem->expire_time ||
+ tmpItem->bound != invItem->bound ||
+ tmpItem->amount > invItem->amount ||
+ tmpItem->amount < 1) {
rodex->clean(sd, 1);
return RODEX_SEND_MAIL_ITEM_ERROR;
}
+ for (j = 0; j < MAX_SLOTS; j++) {
+ if (tmpItem->card[j] != invItem->card[j]) {
+ rodex->clean(sd, 1);
+ return RODEX_SEND_MAIL_ITEM_ERROR;
+ }
+ }
+ for (j = 0; j < MAX_ITEM_OPTIONS; j++) {
+ if (tmpItem->option[j].index != invItem->option[j].index ||
+ tmpItem->option[j].value != invItem->option[j].value ||
+ tmpItem->option[j].param != invItem->option[j].param) {
+ rodex->clean(sd, 1);
+ return RODEX_SEND_MAIL_ITEM_ERROR;
+ }
+ }
}
if (total_zeny > 0 && pc->payzeny(sd, (int)total_zeny, LOG_TYPE_MAIL, NULL) != 0) {