Changeset 5594 for pjproject


Ignore:
Timestamp:
May 22, 2017 3:53:35 AM (7 years ago)
Author:
ming
Message:

Fixed #2017: Incorrect parsing of zero length multipart body parts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_multipart.c

    r5569 r5594  
    654654        end_body = curptr; 
    655655 
    656         /* The newline preceeding the delimiter is conceptually part of 
    657          * the delimiter, so trim it from the body. 
     656        /* Note that when body is empty, end_body will be equal 
     657         * to start_body. 
    658658         */ 
    659         if (*(end_body-1) == '\n') 
    660             --end_body; 
    661         if (*(end_body-1) == '\r') 
    662             --end_body; 
     659        if (end_body > start_body) { 
     660            /* The newline preceeding the delimiter is conceptually part of 
     661             * the delimiter, so trim it from the body. 
     662             */ 
     663            if (*(end_body-1) == '\n') 
     664                --end_body; 
     665            if (*(end_body-1) == '\r') 
     666                --end_body; 
     667        } 
    663668 
    664669        /* Now that we have determined the part's boundary, parse it 
Note: See TracChangeset for help on using the changeset viewer.