EOSERV Bug Tracker > Bug #425: Check NPC ID's when handling a packets!

Bug #425: Check NPC ID's when handling a packets!

Check NPC ID's when handling a packets!
ID #425
Submitter insomniac
Product EOSERV
Severity Normal
Status CLOSED, INVALID
Submitted 13th Aug 2016
Updated 13th Sep 2016
insomniac Submitter 7 years, 36 weeks ago

I was just thinking as an exmple when the server handles certain packets for instance:

// Talked to a barber NPC

void Barber_Open(Character *character, PacketReader &reader)

{

short id = reader.GetShort();

UTIL_FOREACH(character->map->npcs, npc)

{

if (npc->index == id && npc->ENF().type == ENF::Barber)

{

The server doesnt check if id is valid before executing so if it runs a simple check in a few different handlers

unsigned char max_index = util::to_int(character->world->config["MaxNPCIndex"];

if(id <= 0 || id > (max_index > 0 && max_index < 255 ? max_index : 250)) return;

It could possibly improve performance.

Comments

Sausage Developer 7 years, 32 weeks ago

This would be an optimization that basically only comes in to play when someone is trying to interact with NPCs that don't exist somehow. There's no wrong behaviour here.

Updated Status to CLOSED, INVALID

Add Comment

Please don't post unless you have something relevant to the bug to say.
Do not comment to say "thanks" or "fix this please".

Please log in to add comments. EOSERV Bug Tracker > Bug #425: Check NPC ID's when handling a packets!