DarkflameUniverse / DarkflameServer

The main repository for the Darkflame Universe Server Emulator project.
https://www.darkflameuniverse.org/
GNU Affero General Public License v3.0
629 stars 171 forks source link

fix: use after free and uninitialized memory #1603

Closed EmosewaMC closed 1 month ago

EmosewaMC commented 2 months ago

fixes errors spotted in valgrind when logging into the server

UnEquipItem works fine for sending a proxy, however PurgeProxies unfortunately deletes the item you are unequipping silently, causing a use after free when calling UnEquipScripts. For now i have moved UnEquipScripts call up so there is no use after free.

Initialized some structures and variables that were used uninitialized. Checked packet length for incoming packets to ensure we're not reading garbage memory.

Tested that

EmosewaMC commented 1 month ago

Tested that flying to a property no longer reports warnings