Fix SV_SetClient_Ping crash due to unlinked client pointers#687
Fix SV_SetClient_Ping crash due to unlinked client pointers#687themuffinator merged 1 commit intomainfrom
Conversation
SV_CalcPings in the engine can run before ClientConnect has fully linked the entity to the client structure, causing a null pointer dereference when accessing client->edict->client->ping. This change ensures that g_entities[i].client pointers are set immediately upon client array allocation in AllocateClientArray, and cleared in FreeClientArray. This guarantees that valid client slots always have a valid client pointer for the engine to access.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
Fixes a crash in
SV_SetClient_Pingcaused byclient->edict->clientbeing NULL. This happens if the engine iterates over clients (e.g. for ping updates) before the game DLL has fully connected the client to the entity.Changes:
AllocateClientArrayinsrc/server/gameplay/g_clients.cppto initializeg_entities[i+1].clientfor all allocated clients immediately.FreeClientArrayinsrc/server/gameplay/g_clients.cppto clearg_entities[i+1].clientpointers before freeing memory.PR created automatically by Jules for task 6581969964319597072 started by @themuffinator