From: Luigi Rizzo Date: Sat, 18 Nov 2006 18:03:42 +0000 (+0000) Subject: Merged revisions 47823 via svnmerge from X-Git-Tag: 1.6.0-beta1~3^2~3910 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f14aa7094707446e7e0162b407f577d9db0d15bb;p=thirdparty%2Fasterisk.git Merged revisions 47823 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r47823 | rizzo | 2006-11-18 18:59:35 +0100 (Sat, 18 Nov 2006) | 5 lines fix bug 7450 - Parsing fails if From header contains angle brackets (the bug was only in a corner case where the < was right after the opening quote, and the fix is trivial). ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47824 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 5668dc7801..e245c72959 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -8925,11 +8925,12 @@ static char *get_calleridname(const char *input, char *output, size_t outputsize if (!end || end == input) /* we require a part in brackets */ return NULL; - /* move away from "<" */ - end--; + end--; /* move just before "<" */ - /* we found "name" */ - if (tmp && tmp < end) { + if (tmp && tmp <= end) { + /* The quote (tmp) precedes the bracket (end+1). + * Find the matching quote and return the content. + */ end = strchr(tmp+1, '"'); if (!end) return NULL; @@ -8939,7 +8940,7 @@ static char *get_calleridname(const char *input, char *output, size_t outputsize bytes = maxbytes; ast_copy_string(output, tmp + 1, bytes); } else { - /* we didn't find "name" */ + /* No quoted string, or it is inside brackets. */ /* clear the empty characters in the begining*/ input = ast_skip_blanks(input); /* clear the empty characters in the end */