Merge pull request #273 from rkta/bsoob

Fix OOB access due to multiple backspaces
This commit is contained in:
Tatsuya Kinoshita
2023-07-18 21:05:21 +09:00
committed by GitHub

10
etc.c
View File

@@ -393,7 +393,10 @@ checkType(Str s, Lineprop **oprop, Linecolor **ocolor)
if (color) if (color)
color -= plen; color -= plen;
#endif #endif
plen = *(--plens); if (plens == plens_buffer)
plen = 0;
else
plen = *(--plens);
str += 2; str += 2;
} }
} }
@@ -419,7 +422,10 @@ checkType(Str s, Lineprop **oprop, Linecolor **ocolor)
if (color) if (color)
color -= plen; color -= plen;
#endif #endif
plen = *(--plens); if (plens == plens_buffer)
plen = 0;
else
plen = *(--plens);
str++; str++;
} }
#else #else