diff options
author | Haru <haru@dotalux.com> | 2017-08-11 02:23:57 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2017-08-11 02:23:57 +0200 |
commit | 37b1dcf5319e5de89edd41c083a27ef63ebce9da (patch) | |
tree | db522ed6fa975ae92b0314a419af69639064ed92 /src/map/rodex.c | |
parent | 10c1e5e65348c5d257b23064c87dcfe83ff68973 (diff) | |
download | hercules-37b1dcf5319e5de89edd41c083a27ef63ebce9da.tar.gz hercules-37b1dcf5319e5de89edd41c083a27ef63ebce9da.tar.bz2 hercules-37b1dcf5319e5de89edd41c083a27ef63ebce9da.tar.xz hercules-37b1dcf5319e5de89edd41c083a27ef63ebce9da.zip |
Fix various issues detected by coverity in rodex-related code
Follow-up to 544da439e81ff78ec102b754e16b6cc0a28a6d0a
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/rodex.c')
-rw-r--r-- | src/map/rodex.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/map/rodex.c b/src/map/rodex.c index 03191ab22..507cbf2ca 100644 --- a/src/map/rodex.c +++ b/src/map/rodex.c @@ -304,9 +304,9 @@ int rodex_send_mail(struct map_session_data *sd, const char *receiver_name, cons if (sd->rodex.tmp.zeny > 0) sd->rodex.tmp.type |= MAIL_TYPE_ZENY; sd->rodex.tmp.sender_id = sd->status.char_id; - strncpy(sd->rodex.tmp.sender_name, sd->status.name, NAME_LENGTH); - strncpy(sd->rodex.tmp.title, title, RODEX_TITLE_LENGTH); - strncpy(sd->rodex.tmp.body, body, RODEX_BODY_LENGTH); + safestrncpy(sd->rodex.tmp.sender_name, sd->status.name, NAME_LENGTH); + safestrncpy(sd->rodex.tmp.title, title, RODEX_TITLE_LENGTH); + safestrncpy(sd->rodex.tmp.body, body, RODEX_BODY_LENGTH); intif->rodex_sendmail(&sd->rodex.tmp); return RODEX_SEND_MAIL_SUCCESS; // this will not inform client of the success yet. (see rodex_send_mail_result) @@ -470,8 +470,8 @@ void rodex_get_items(struct map_session_data *sd, int8 opentype, int64 mail_id) if (j < msg->items_count) { struct item_data *idata = itemdb->search(sd->status.inventory[i].nameid); - if ((idata->stack.inventory && sd->status.inventory[i].amount + msg->items[i].item.amount > idata->stack.amount) || - sd->status.inventory[i].amount + msg->items[i].item.amount > MAX_AMOUNT) { + if ((idata->stack.inventory && sd->status.inventory[i].amount + msg->items[j].item.amount > idata->stack.amount) || + sd->status.inventory[i].amount + msg->items[j].item.amount > MAX_AMOUNT) { clif->rodex_request_items(sd, opentype, mail_id, RODEX_GET_ITEM_FULL_ERROR); return; } |