Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
d9596b50
Commit
d9596b50
authored
6 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_pjsip: Remove spurious error logging when printing silent headers"
parents
259f4868
0e897611
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch
+29
-20
29 additions, 20 deletions
...s/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch
with
29 additions
and
20 deletions
third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch
+
29
−
20
View file @
d9596b50
From cf6b662b8fe450ea7dc6eb5adb2b878971ce0d67 Mon Sep 17 00:00:00 2001
From 88409082a4cbf27b308c76c148270ee72fdcb503 Mon Sep 17 00:00:00 2001
From: George Joseph <gjoseph@digium.com>
From: Riza Sulistyo <riza@teluu.com>
Date: Wed, 10 Jan 2018 08:48:32 -0700
Date: Wed, 17 Jan 2018 11:30:52 +0000
Subject: [PATCH] sip_msg: Prevent crash on header without vptr
Subject: [PATCH] r5727 svn backport sip_msg: Prevent crash on header without
vptr
Re #2059 (misc): Prevent corrupt header from causing a crash when printed.
Thanks to George Joseph for the patch.
Occasionally a header with no vptr gets into the list of header. This
Occasionally a header with no vptr gets into the list of header. This
causes a crash when printing them. We still need to figure out how
causes a crash when printing them. We still need to figure out how
the header got there but this patch at least prevents the crash by checking
the header got there but this patch at least prevents the crash by checking
for a non-NULL vptr before attempting to call its print function.
for a non-NULL vptr before attempting to call its print function.
---
---
pjsip/src/pjsip/sip_msg.c |
6
++++++
pjsip/src/pjsip/sip_msg.c |
11
++++++
+++--
1 file changed,
6
insertions(+)
1 file changed,
9
insertions(+)
, 2 deletions(-)
diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c
diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c
index
76d07b563..194b5ee01
100644
index
a13f80e..8819dd9
100644
--- a/pjsip/src/pjsip/sip_msg.c
--- a/pjsip/src/pjsip/sip_msg.c
+++ b/pjsip/src/pjsip/sip_msg.c
+++ b/pjsip/src/pjsip/sip_msg.c
@@ -26,6 +26,7 @@
@@ -26,6 +26,7 @@
...
@@ -23,25 +27,30 @@ index 76d07b563..194b5ee01 100644
...
@@ -23,25 +27,30 @@ index 76d07b563..194b5ee01 100644
#include <pjlib-util/string.h>
#include <pjlib-util/string.h>
PJ_DEF_DATA(const pjsip_method) pjsip_invite_method =
PJ_DEF_DATA(const pjsip_method) pjsip_invite_method =
@@ -469,6 +470,8 @@
PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg,
@@ -461,8 +462,13 @@
PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg,
/* Print each of the headers. */
*p++ = '\r';
for (hdr=msg->hdr.next; hdr!=&msg->hdr; hdr=hdr->next) {
*p++ = '\n';
len = pjsip_hdr_print_on(hdr, p, end-p);
+ } else {
- if (len < 0)
+ PJ_LOG(1, ("sip_msg", "Header with no vptr encountered!! Current buffer: %.*s", (int)(p-buf), buf));
- return -1;
}
+ if (len < 0) {
}
+ if (len == -2) {
+ PJ_LOG(5, ("sip_msg", "Header with no vptr encountered!! "\
+ "Current buffer: %.*s", (int)(p-buf), buf));
+ }
+ return len;
+ }
@@ -576,6 +579,9 @@
PJ_DEF(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr_ptr )
if (len > 0) {
p += len;
@@ -578,6 +584,7 @@
PJ_DEF(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr_ptr )
PJ_DEF(int) pjsip_hdr_print_on( void *hdr_ptr, char *buf, pj_size_t len)
PJ_DEF(int) pjsip_hdr_print_on( void *hdr_ptr, char *buf, pj_size_t len)
{
{
pjsip_hdr *hdr = (pjsip_hdr*) hdr_ptr;
pjsip_hdr *hdr = (pjsip_hdr*) hdr_ptr;
+ if (!hdr->vptr) {
+ PJ_ASSERT_RETURN(hdr->vptr, -2);
+ return 0;
+ }
return (*hdr->vptr->print_on)(hdr_ptr, buf, len);
return (*hdr->vptr->print_on)(hdr_ptr, buf, len);
}
}
--
--
2.
14.3
2.
7.4
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment