Changeset 4641


Ignore:
Timestamp:
11/04/13 03:05:43 (5 years ago)
Author:
nanang
Message:

Fix #1709: Fixed scanner in processing escaped quote right after quote begin.

Location:
pjproject/trunk
Files:
2 edited

Legend:

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

    r4537 r4641  
    384384        if (*s == end_quote[qpair]) { 
    385385            if (*(s-1) == '\\') { 
    386                 if (s-2 == scanner->begin) { 
     386                char *q = s-2; 
     387                char *r = s-2; 
     388 
     389                while (r != scanner->begin && *r == '\\') { 
     390                    --r; 
     391                } 
     392                /* break from main loop if we have odd number of backslashes */ 
     393                if (((unsigned)(q-r) & 0x01) == 1) { 
    387394                    break; 
    388                 } else { 
    389                     char *q = s-2; 
    390                     char *r = s-2; 
    391  
    392                     while (r != scanner->begin && *r == '\\') { 
    393                         --r; 
    394                     } 
    395                     /* break from main loop if we have odd number of backslashes */ 
    396                     if (((unsigned)(q-r) & 0x01) == 1) { 
    397                         break; 
    398                     } 
    399                     ++s; 
    400395                } 
     396                ++s; 
    401397            } else { 
    402398                /* end_quote is not preceeded by backslash. break now. */ 
  • pjproject/trunk/pjsip/src/test/uri_test.c

    r4537 r4641  
    8484static pjsip_uri *create_uri38( pj_pool_t *pool ); 
    8585static pjsip_uri *create_uri39( pj_pool_t *pool ); 
     86static pjsip_uri *create_uri40( pj_pool_t *pool ); 
    8687static pjsip_uri *create_dummy( pj_pool_t *pool ); 
    8788 
     
    358359        "\"User\\\\\" <sip:localhost>", 
    359360        &create_uri39, 
     361    }, 
     362    { 
     363        /* Quoted display name. */ 
     364        PJ_SUCCESS, 
     365        "\"\\\"User\\\"\" <sip:localhost>", 
     366        &create_uri40, 
    360367    } 
    361368 
     
    778785 
    779786    pj_strdup2(pool, &name_addr->display, "User\\\\"); 
     787    pj_strdup2(pool, &url->host, "localhost"); 
     788    return (pjsip_uri*)name_addr; 
     789} 
     790 
     791/* "\"\\\"User\\\"\" <sip:localhost>" */ 
     792static pjsip_uri *create_uri40(pj_pool_t *pool) 
     793{ 
     794    pjsip_name_addr *name_addr = pjsip_name_addr_create(pool); 
     795    pjsip_sip_uri *url; 
     796 
     797    url = pjsip_sip_uri_create(pool, 0); 
     798    name_addr->uri = (pjsip_uri*) url; 
     799 
     800    pj_strdup2(pool, &name_addr->display, "\\\"User\\\""); 
    780801    pj_strdup2(pool, &url->host, "localhost"); 
    781802    return (pjsip_uri*)name_addr; 
Note: See TracChangeset for help on using the changeset viewer.