Misc (re #1068): fixed possible reading string beyond the buffer in pj_strltrim() if the string only contains whitespaces (thanks Jones Desougi for the report)
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@3207 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/src/pj/string.c b/pjlib/src/pj/string.c
index 807962b..073cf26 100644
--- a/pjlib/src/pj/string.c
+++ b/pjlib/src/pj/string.c
@@ -69,8 +69,9 @@
PJ_DEF(pj_str_t*) pj_strltrim( pj_str_t *str )
{
+ char *end = str->ptr + str->slen;
register char *p = str->ptr;
- while (pj_isspace(*p))
+ while (p < end && pj_isspace(*p))
++p;
str->slen -= (p - str->ptr);
str->ptr = p;