Nitro Booster Luigina 18 Posted January 17 Nitro Booster Share Posted January 17 (edited) Hello community ! I found an issue when i was checking ShopEx system. If your pack_tab size is bigger than default m2 / SHOP_HOST_ITEM_MAX_NUM is bigger than default this overflow occurs. This causes a core crash as seen in the screenshot below: https://metin2.download/picture/n2KPdWX19ovTCs9nLW684fA6IibqhrTu/.png Solution I use temp buffer for handle better but you can change 8096 too. To solve this problem, you can follow these steps: // In shopEx.cpp -------------------------------------------------------------- // Search char temp[8096]; char* buf = &temp[0]; size_t size = 0; // Change like this TEMP_BUFFER buf(16 * 1024); -------------------------------------------------------------- // Search memcpy(buf, &pack_tab, sizeof(pack_tab)); buf += sizeof(pack_tab); size += sizeof(pack_tab); // Change like this buf.write(&pack_tab, sizeof(pack_tab)); -------------------------------------------------------------- // Search pack.size = sizeof(pack) + sizeof(pack2) + size; // Change like this pack.size = sizeof(pack) + sizeof(pack2) + buf.size(); -------------------------------------------------------------- // Search ch->GetDesc()->Packet(temp, size); // Change like this ch->GetDesc()->Packet(buf.read_peek(), buf.size()); After following these steps, you should have overcome this problem in the ShopEx system. If you have any problems, please leave a comment. Kind regards, Luigina Edited January 17 by Metin2 Dev International Core X - External 2 Internal 2 1 3 1 Link to comment Share on other sites More sharing options...
Contributor Amun 1918 Posted January 20 Contributor Share Posted January 20 (edited) That picture says that you're calling AddGuest on a null pointer, which is why you're getting the crash. Update: Ok, yeah, I think you're right(also using the TEMP_BUFFER is much better than ballparking the size of your buffers). Been too tired when writing this, don't mind my ass Edited January 20 by Amun 1 Link to comment Share on other sites More sharing options...
Nitro Booster Luigina 18 Posted January 20 Author Nitro Booster Share Posted January 20 2 hours ago, Amun said: That picture says that you're calling AddGuest on a null pointer, which is why you're getting the crash. There isn't any way to null pointer. I just click to npc and got crash. Did you see the size on crash ? I did that change and my problem solved. King regards ! 1 Link to comment Share on other sites More sharing options...
CONTROL 81 Posted January 20 Share Posted January 20 (edited) I remember I ran into this 4 years ago or something, and I just threw a *4 after the number 8096 and looked away But this seems more efficient thx < 3 Edited January 20 by CONTROL 1 Link to comment Share on other sites More sharing options...
FALLEN1 1 Posted January 24 Share Posted January 24 What did you mean with TEMP_BUFFER buf(16 * 1024);? I mean, why 16 * 1024? And in this case: char temp[8096 * SHOP_TAB_COUNT_MAX]; I should put 16 * 1024 or should increase? Link to comment Share on other sites More sharing options...
Nitro Booster Luigina 18 Posted January 26 Author Nitro Booster Share Posted January 26 On 1/24/2024 at 10:54 PM, FALLEN1 said: What did you mean with TEMP_BUFFER buf(16 * 1024);? I mean, why 16 * 1024? And in this case: char temp[8096 * SHOP_TAB_COUNT_MAX]; I should put 16 * 1024 or should increase? You can change like that TEMP_BUFFER buf(8 * 1024 * SHOP_TAB_COUNT_MAX); Link to comment Share on other sites More sharing options...
Recommended Posts