Changeset 3207


Ignore:
Timestamp:
Jun 16, 2010 2:49:37 PM (9 years ago)
Author:
bennylp
Message:

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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/string.c

    r2394 r3207  
    7070PJ_DEF(pj_str_t*) pj_strltrim( pj_str_t *str ) 
    7171{ 
     72    char *end = str->ptr + str->slen; 
    7273    register char *p = str->ptr; 
    73     while (pj_isspace(*p)) 
     74    while (p < end && pj_isspace(*p)) 
    7475        ++p; 
    7576    str->slen -= (p - str->ptr); 
Note: See TracChangeset for help on using the changeset viewer.