Changeset 5727


Ignore:
Timestamp:
Jan 17, 2018 11:30:52 AM (17 months ago)
Author:
riza
Message:

Re #2059 (misc): Prevent corrupt header from causing a crash when printed.
Thanks to George Joseph for the patch.

File:
1 edited

Legend:

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

    r5701 r5727  
    2727#include <pj/pool.h> 
    2828#include <pj/assert.h> 
     29#include <pj/log.h> 
    2930#include <pjlib-util/string.h> 
    3031 
     
    460461    for (hdr=msg->hdr.next; hdr!=&msg->hdr; hdr=hdr->next) { 
    461462        len = pjsip_hdr_print_on(hdr, p, end-p); 
    462         if (len < 0) 
    463             return -1; 
     463        if (len < 0) { 
     464           if (len == -2) { 
     465               PJ_LOG(5, ("sip_msg", "Header with no vptr encountered!! "\ 
     466                          "Current buffer: %.*s", (int)(p-buf), buf)); 
     467           } 
     468           return len; 
     469        } 
    464470 
    465471        if (len > 0) { 
     
    577583{ 
    578584    pjsip_hdr *hdr = (pjsip_hdr*) hdr_ptr; 
     585    PJ_ASSERT_RETURN(hdr->vptr, -2); 
    579586    return (*hdr->vptr->print_on)(hdr_ptr, buf, len); 
    580587} 
Note: See TracChangeset for help on using the changeset viewer.