Changeset 570


Ignore:
Timestamp:
Jul 2, 2006 9:29:09 AM (18 years ago)
Author:
bennylp
Message:

Fixed bugs in scanner: (1) pj_cis_match() takes int argument, so when ASCII character above 127 is given, it will access the array with negative index, and (2) pj_scan_get_newline() may incorrectly eat two newlines when the second newline is a header continuation

Location:
pjproject/trunk/pjlib-util
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/build

    • Property svn:ignore
      •  

        old new  
        77*vcproj* 
        88*.sln 
         9*.plg 
  • pjproject/trunk/pjlib-util/include/pjlib-util/scanner.h

    r472 r570  
    157157 * @return          Non-zero if match (not necessarily one). 
    158158 */ 
    159 PJ_INLINE(int) pj_cis_match( const pj_cis_t *cis, int c ) 
     159PJ_INLINE(int) pj_cis_match( const pj_cis_t *cis, pj_uint8_t c ) 
    160160{ 
    161161    return PJ_CIS_ISSET(cis, c); 
  • pjproject/trunk/pjlib-util/src/pjlib-util/scanner.c

    r185 r570  
    402402    scanner->start_line = scanner->curptr; 
    403403 
    404     if (PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && scanner->skip_ws) { 
    405         pj_scan_skip_whitespace(scanner); 
    406     } 
     404    /** 
     405     * This probably is a bug, see PROTOS test #2480. 
     406     * This would cause scanner to incorrectly eat two new lines, e.g. 
     407     * when parsing: 
     408     *    
     409     *  Content-Length: 120\r\n 
     410     *  \r\n 
     411     *  <space><space><space>... 
     412     * 
     413     * When pj_scan_get_newline() is called to parse the first newline 
     414     * in the Content-Length header, it will eat the second newline 
     415     * too because it thinks that it's a header continuation. 
     416     * 
     417     * if (PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && scanner->skip_ws) { 
     418     *    pj_scan_skip_whitespace(scanner); 
     419     * } 
     420     */ 
    407421} 
    408422 
Note: See TracChangeset for help on using the changeset viewer.