Add bounds check to C_GetNextLabelName(). This isn't really necessary because the extra writes to the label buffer are immediately overwritten by the next label found, but I could see it causing a crash in an edge case where somehow the maximum number of labels had been defined.

git-svn-id: https://svn.eduke32.com/eduke32@7246 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-12-15 01:36:32 +00:00
parent 8b0cce6cb7
commit f40026a0be

View file

@ -1010,7 +1010,11 @@ static void C_GetNextLabelName(void)
// while (ispecial(*textptr) == 0 && *textptr!='['&& *textptr!=']' && *textptr!='\t' && *textptr!='\n' && *textptr!='\r') // while (ispecial(*textptr) == 0 && *textptr!='['&& *textptr!=']' && *textptr!='\t' && *textptr!='\n' && *textptr!='\r')
while (C_IsLabelChar(*textptr, i)) while (C_IsLabelChar(*textptr, i))
label[(g_labelCnt<<6)+(i++)] = *(textptr++); {
if (i < (1<<6)-1)
label[(g_labelCnt<<6) + (i++)] = *textptr;
textptr++;
}
label[(g_labelCnt<<6)+i] = 0; label[(g_labelCnt<<6)+i] = 0;