Skip to content
Permalink
Browse files
Fixed a possible mapserver crash
  • Loading branch information
Lemongrass3110 committed Aug 16, 2018
1 parent 3d8104d commit ae89b3a7b2aeac15c67478da0d36985814c08391
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/map/mail.cpp
@@ -143,7 +143,7 @@ enum mail_attach_result mail_setitem(struct map_session_data *sd, short idx, uin

idx -= 2;

if( idx < 0 || idx >= MAX_INVENTORY )
if( idx < 0 || idx >= MAX_INVENTORY || sd->inventory_data[idx] == nullptr )
return MAIL_ATTACH_ERROR;

#if PACKETVER < 20150513

1 comment on commit ae89b3a

@drifterxxxx2
Copy link

@drifterxxxx2 drifterxxxx2 commented on ae89b3a Aug 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @Lemongrass3110 thanks for the patch
i'm still getting a crash after this fix, but i'm not sure if it is related.
using hash c5ceda0 but i patch manually
is this related?
thanks in advance!

Program received signal SIGSEGV, Segmentation fault.
0x0000555555626b80 in mail_setitem (sd=sd@entry=0x55555b9ef0f0, idx=1,
idx@entry=3, amount=amount@entry=1) at mail.cpp:197
197 total += amount * sd->inventory_data[idx]->weight / 10;
(gdb) bt full
#0 0x0000555555626b80 in mail_setitem (sd=sd@entry=0x55555b9ef0f0, idx=1,
idx@entry=3, amount=amount@entry=1) at mail.cpp:197
i = 0
j = <optimized out>
total = <optimized out>
#1 0x00005555555ed1ce in clif_parse_Mail_setattach (fd=<optimized out>,
sd=0x55555b9ef0f0) at clif.cpp:15902
info = <optimized out>
idx = 3
amount = 1
flag = <optimized out>
#2 0x00005555555d5f04 in clif_parse (fd=<optimized out>) at clif.cpp:20765
cmd = <optimized out>
packet_len = 6
sd = <optimized out>
pnum = 0
#3 0x00005555555746e5 in main ()
No symbol table info available.

Please sign in to comment.