DarkflameUniverse / DarkflameServer

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

fix: use after free and uninitialized memory #1603

Closed EmosewaMC closed 5 months ago

EmosewaMC commented 6 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 5 months ago

Tested that flying to a property no longer reports warnings