<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9485">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip: Remove spurious error logging when printing silent headers<br><br>Asterisk patched the pjproject source to avoid crashing when pjproject<br>sip_msg headers are encountered with NULL vptr's, but the patch also<br>output error messages for some valid headers which simply did not need<br>to be added to the message itself, such as hidden route headers.<br><br>pjproject has since applied a similar patch to their baseline to avoid<br>crashes, but their version also avoids the spurious error logging.<br><br>Lets use their patch instead.<br><br>ASTERISK-27961 #close<br><br>Change-Id: I2ddbd82c8da10e0dcc9807a48089d1f3c2d6e389<br>---<br>M third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch<br>1 file changed, 29 insertions(+), 20 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch b/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch</span><br><span>index c96292a..7508ab8 100644</span><br><span>--- a/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch</span><br><span>+++ b/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch</span><br><span>@@ -1,18 +1,22 @@</span><br><span style="color: hsl(0, 100%, 40%);">-From cf6b662b8fe450ea7dc6eb5adb2b878971ce0d67 Mon Sep 17 00:00:00 2001</span><br><span style="color: hsl(0, 100%, 40%);">-From: George Joseph <gjoseph@digium.com></span><br><span style="color: hsl(0, 100%, 40%);">-Date: Wed, 10 Jan 2018 08:48:32 -0700</span><br><span style="color: hsl(0, 100%, 40%);">-Subject: [PATCH] sip_msg: Prevent crash on header without vptr</span><br><span style="color: hsl(120, 100%, 40%);">+From 88409082a4cbf27b308c76c148270ee72fdcb503 Mon Sep 17 00:00:00 2001</span><br><span style="color: hsl(120, 100%, 40%);">+From: Riza Sulistyo <riza@teluu.com></span><br><span style="color: hsl(120, 100%, 40%);">+Date: Wed, 17 Jan 2018 11:30:52 +0000</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: [PATCH] r5727 svn backport sip_msg: Prevent crash on header without</span><br><span style="color: hsl(120, 100%, 40%);">+ vptr</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Re #2059 (misc): Prevent corrupt header from causing a crash when printed.</span><br><span style="color: hsl(120, 100%, 40%);">+Thanks to George Joseph for the patch.</span><br><span> </span><br><span> Occasionally a header with no vptr gets into the list of header. This</span><br><span> causes a crash when printing them. We still need to figure out how</span><br><span> the header got there but this patch at least prevents the crash by checking</span><br><span> for a non-NULL vptr before attempting to call its print function.</span><br><span> ---</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/src/pjsip/sip_msg.c | 6 ++++++</span><br><span style="color: hsl(0, 100%, 40%);">- 1 file changed, 6 insertions(+)</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip/src/pjsip/sip_msg.c | 11 +++++++++--</span><br><span style="color: hsl(120, 100%, 40%);">+ 1 file changed, 9 insertions(+), 2 deletions(-)</span><br><span> </span><br><span> diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c</span><br><span style="color: hsl(0, 100%, 40%);">-index 76d07b563..194b5ee01 100644</span><br><span style="color: hsl(120, 100%, 40%);">+index a13f80e..8819dd9 100644</span><br><span> --- a/pjsip/src/pjsip/sip_msg.c</span><br><span> +++ b/pjsip/src/pjsip/sip_msg.c</span><br><span> @@ -26,6 +26,7 @@</span><br><span>@@ -23,25 +27,30 @@</span><br><span> #include <pjlib-util/string.h></span><br><span> </span><br><span> PJ_DEF_DATA(const pjsip_method) pjsip_invite_method =</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -469,6 +470,8 @@ PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg,</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -461,8 +462,13 @@ PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg,</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Print each of the headers. */</span><br><span style="color: hsl(120, 100%, 40%);">+ for (hdr=msg->hdr.next; hdr!=&msg->hdr; hdr=hdr->next) {</span><br><span style="color: hsl(120, 100%, 40%);">+ len = pjsip_hdr_print_on(hdr, p, end-p);</span><br><span style="color: hsl(120, 100%, 40%);">+- if (len < 0)</span><br><span style="color: hsl(120, 100%, 40%);">+- return -1;</span><br><span style="color: hsl(120, 100%, 40%);">++ if (len < 0) {</span><br><span style="color: hsl(120, 100%, 40%);">++ if (len == -2) {</span><br><span style="color: hsl(120, 100%, 40%);">++ PJ_LOG(5, ("sip_msg", "Header with no vptr encountered!! "\</span><br><span style="color: hsl(120, 100%, 40%);">++ "Current buffer: %.*s", (int)(p-buf), buf));</span><br><span style="color: hsl(120, 100%, 40%);">++ }</span><br><span style="color: hsl(120, 100%, 40%);">++ return len;</span><br><span style="color: hsl(120, 100%, 40%);">++ }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- *p++ = '\r';</span><br><span style="color: hsl(0, 100%, 40%);">- *p++ = '\n';</span><br><span style="color: hsl(0, 100%, 40%);">-+ } else {</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_LOG(1, ("sip_msg", "Header with no vptr encountered!! Current buffer: %.*s", (int)(p-buf), buf));</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-@@ -576,6 +579,9 @@ PJ_DEF(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr_ptr )</span><br><span style="color: hsl(120, 100%, 40%);">+ if (len > 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ p += len;</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -578,6 +584,7 @@ PJ_DEF(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr_ptr )</span><br><span> PJ_DEF(int) pjsip_hdr_print_on( void *hdr_ptr, char *buf, pj_size_t len)</span><br><span> {</span><br><span> pjsip_hdr *hdr = (pjsip_hdr*) hdr_ptr;</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (!hdr->vptr) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ return 0;</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(120, 100%, 40%);">++ PJ_ASSERT_RETURN(hdr->vptr, -2);</span><br><span> return (*hdr->vptr->print_on)(hdr_ptr, buf, len);</span><br><span> }</span><br><span> </span><br><span> -- </span><br><span style="color: hsl(0, 100%, 40%);">-2.14.3</span><br><span style="color: hsl(120, 100%, 40%);">+2.7.4</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9485">change 9485</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9485"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I2ddbd82c8da10e0dcc9807a48089d1f3c2d6e389 </div>
<div style="display:none"> Gerrit-Change-Number: 9485 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Nick French <naf@ou.edu> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>