summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorMartin Pycko <martinp@digium.com>2003-06-08 16:26:08 +0000
committerMartin Pycko <martinp@digium.com>2003-06-08 16:26:08 +0000
commitc680adba74e2d47a9a9fc2fe4b4100cac66092b7 (patch)
tree464bdd67892e7b0cdf0718a6a4fba94caf7b46ae /channels
parent731dccfccc853bc798a2f89600d52ec9d0ec85e8 (diff)
Fix the segfault in get_calleridname if the From: string starts with "<sip:..."
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1079 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_sip.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 5c14899d6..58ef4530d 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3326,7 +3326,7 @@ static char *get_calleridname(char *input,char *output)
{
char *end = strchr(input,'<');
char *tmp = strchr(input,'\"');
- if (!end) return NULL;
+ if (!end || (end == input)) return NULL;
/* move away from "<" */
end--;
/* we found "name" */
@@ -3342,7 +3342,10 @@ static char *get_calleridname(char *input,char *output)
/* clear the empty characters in the end */
while(*end && (*end < 33) && end > input)
end--;
- strncpy(output,input,(int)(end-input));
+ if (end > input)
+ strncpy(output,input,(int)(end-input));
+ else
+ output = NULL;
}
return output;
}