summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-08-11 02:23:57 +0200
committerHaru <haru@dotalux.com>2017-08-11 02:23:57 +0200
commit37b1dcf5319e5de89edd41c083a27ef63ebce9da (patch)
treedb522ed6fa975ae92b0314a419af69639064ed92 /src
parent10c1e5e65348c5d257b23064c87dcfe83ff68973 (diff)
downloadhercules-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')
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/intif.c2
-rw-r--r--src/map/rodex.c10
3 files changed, 7 insertions, 7 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index c13a3ea80..bd815e055 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -19249,7 +19249,7 @@ void clif_rodex_open_write_mail(int fd, const char *receiver_name, int8 result)
WFIFOHEAD(fd, sizeof(*sPacket));
sPacket = WFIFOP(fd, 0);
sPacket->PacketType = rodexopenwrite;
- strncpy(sPacket->receiveName, receiver_name, NAME_LENGTH);
+ safestrncpy(sPacket->receiveName, receiver_name, NAME_LENGTH);
sPacket->result = result;
WFIFOSET(fd, sizeof(*sPacket));
#endif
diff --git a/src/map/intif.c b/src/map/intif.c
index de862b4dd..d4fa026a2 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -2607,7 +2607,7 @@ void intif_parse_RodexCheckName(int fd)
}
sd->rodex.tmp.receiver_id = target_char_id;
- strncpy(sd->rodex.tmp.receiver_name, name, NAME_LENGTH);
+ safestrncpy(sd->rodex.tmp.receiver_name, name, NAME_LENGTH);
clif->rodex_checkname_result(sd, target_char_id, target_class, target_level, name);
}
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;
}