Improve DB and Nano sanity checks

I'm aware that the DB checks still allow ID 0 items and Nanos, but the
point of those is primarily to prevent invalid memory access.
This commit is contained in:
2021-01-27 02:27:08 +01:00
parent 04a17ed862
commit 217168fe50
2 changed files with 8 additions and 4 deletions

View File

@@ -240,7 +240,7 @@ void NanoManager::nanoPotionHandler(CNSocket* sock, CNPacketData* data) {
#pragma region Helper methods
void NanoManager::addNano(CNSocket* sock, int16_t nanoID, int16_t slot, bool spendfm) {
if (nanoID >= NANO_COUNT)
if (nanoID <= 0 || nanoID >= NANO_COUNT)
return;
Player *plr = PlayerManager::getPlayer(sock);