aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-02 17:49:36 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-02 17:49:36 +0000
commit6267a060dee5a1c0de75d03179f124eb398d5f4f (patch)
tree713cae62592accbff59a8a993e99fc87e274dfe7 /channels
parent1de5da674f0d26af33de9f2eaf6d9c012d22ea73 (diff)
Merged revisions 62692 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r62692 | tilghman | 2007-05-02 12:43:48 -0500 (Wed, 02 May 2007) | 12 lines Merged revisions 62691 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r62691 | tilghman | 2007-05-02 12:38:16 -0500 (Wed, 02 May 2007) | 4 lines Issue 9638 - if a text frame is sent with no terminating NULL through a bridged IAX connection, the remote end will receive garbage characters tacked onto the end. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@62693 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_iax2.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index a250899a6..6403bf6ad 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -6822,6 +6822,13 @@ static int socket_process(struct iax2_thread *thread)
ast_mutex_unlock(&iaxsl[fr->callno]);
return 1;
}
+ /* Ensure text frames are NULL-terminated */
+ if (f.frametype == AST_FRAME_TEXT && thread->buf[res - 1] != '\0') {
+ if (res < sizeof(thread->buf))
+ thread->buf[res++] = '\0';
+ else /* Trims one character from the text message, but that's better than overwriting the end of the buffer. */
+ thread->buf[res - 1] = '\0';
+ }
f.datalen = res - sizeof(*fh);
/* Handle implicit ACKing unless this is an INVAL, and only if this is