Avoid reading outside the provided range

This commit is contained in:
dmiller 2022-12-02 21:57:28 +00:00
parent d957ca1274
commit 7dcca32ff1

View file

@ -125,7 +125,7 @@ const char *string_pool_substr(const char *s, const char *t)
}
const char *string_pool_substr_strip(const char *s, const char *t) {
while (isspace((int) (unsigned char) *s))
while (s < t && isspace((int) (unsigned char) *s))
s++;
while (t > s && isspace((int) (unsigned char) *(t - 1)))
t--;