From 347750519c438bd9a90083796537780e9a355af3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 13 Aug 2017 21:52:11 +0300 Subject: Adjust rodex packet versions based on tests. --- src/map/clif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3-70-g09d2 From 494cb78c98e2e72fa81932462dce22c2beafda96 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 23 Aug 2017 00:56:01 +0300 Subject: Add SC_DAILYSENDMAILCNT into constants.conf and sc_config.txt Without this check player may ignore mail send limit. --- db/constants.conf | 2 ++ db/sc_config.txt | 2 ++ 2 files changed, 4 insertions(+) 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 -- cgit v1.2.3-70-g09d2 From cb2924a3d4cf138587daff750b5278e9d30975e6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 5 Sep 2017 02:18:18 +0300 Subject: Add missing checks in attaching item to rodex mail. Also fix buffer overflow in requesting items from rodex mail. --- src/map/rodex.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) 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) { -- cgit v1.2.3-70-g09d2