Skip to content
Snippets Groups Projects
Commit 3ed2221e authored by Logan Aerl Arias's avatar Logan Aerl Arias
Browse files

Merge branch 'fix-buffer-overflow-mobj-typename' into 'next'

Fix buffer overflow when when fetching typenames on freeslots

See merge request STJr/SRB2!2193
parents 3ba48ba4 7e8c0d87
No related branches found
No related tags found
2 merge requests!2355fix newer versions of mixerx,!2193Fix buffer overflow when when fetching typenames on freeslots
Pipeline #1616 canceled
...@@ -226,21 +226,22 @@ void P_AddThinker(const thinklistnum_t n, thinker_t *thinker) ...@@ -226,21 +226,22 @@ void P_AddThinker(const thinklistnum_t n, thinker_t *thinker)
#ifdef PARANOIA #ifdef PARANOIA
static const char *MobjTypeName(const mobj_t *mobj) static const char *MobjTypeName(const mobj_t *mobj)
{ {
mobjtype_t type;
actionf_p1 p1 = mobj->thinker.function.acp1; actionf_p1 p1 = mobj->thinker.function.acp1;
if (p1 == (actionf_p1)P_MobjThinker) if (p1 == (actionf_p1)P_MobjThinker)
{ type = mobj->type;
return MOBJTYPE_LIST[mobj->type]; else if (p1 == (actionf_p1)P_RemoveThinkerDelayed && mobj->thinker.debug_mobjtype != MT_NULL)
} type = mobj->thinker.debug_mobjtype;
else if (p1 == (actionf_p1)P_RemoveThinkerDelayed) else
{ return "<Not a mobj>";
if (mobj->thinker.debug_mobjtype != MT_NULL)
{
return MOBJTYPE_LIST[mobj->thinker.debug_mobjtype];
}
}
return "<Not a mobj>"; if (type < 0 || type >= NUMMOBJTYPES || (type >= MT_FIRSTFREESLOT && !FREE_MOBJS[type - MT_FIRSTFREESLOT]))
return "<Invalid mobj type>";
else if (type >= MT_FIRSTFREESLOT)
return FREE_MOBJS[type - MT_FIRSTFREESLOT]; // This doesn't include "MT_"...
else
return MOBJTYPE_LIST[type];
} }
static const char *MobjThinkerName(const mobj_t *mobj) static const char *MobjThinkerName(const mobj_t *mobj)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment