Ignore:
Timestamp:
Aug 6, 2006 2:11:52 PM (17 years ago)
Author:
bennylp
Message:

Change unescaping function in scanner and string.c to NOT unescape when '%' is not followed by hex digits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/src/pjlib-util/scanner.c

    r583 r654  
    304304    do { 
    305305        if (*s == '%') { 
    306             if (s+3 <= scanner->end) { 
    307                 /* This doesn't check if the hex digits are valid. 
    308                  * If they dont' it will produce garbage characters, but 
    309                  * no harm is done to the application (e.g. no illegal 
    310                  * memory access. 
    311                  */ 
     306            if (s+3 <= scanner->end && pj_isxdigit(*(s+1)) &&  
     307                pj_isxdigit(*(s+2)))  
     308            { 
    312309                *dst = (pj_uint8_t) ((pj_hex_digit_to_val(*(s+1)) << 4) + 
    313310                                      pj_hex_digit_to_val(*(s+2))); 
Note: See TracChangeset for help on using the changeset viewer.