diff options
author | automerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-05-02 18:18:44 +0000 |
---|---|---|
committer | automerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-05-02 18:18:44 +0000 |
commit | 85ba51442f4c792e7f35c379cc5e85f752762f76 (patch) | |
tree | 3b95f1fe86e46954b5e7ad4df5f56e8a5410959f /channels | |
parent | 91073f1bbbb3f453fa3ff8e587af8b0fd2e3221b (diff) |
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@62733 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_iax2.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 95fede071..d11b0b4b8 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -6732,6 +6732,13 @@ static int socket_read(int *id, int fd, short events, void *cbdata) ast_mutex_unlock(&iaxsl[fr->callno]); return 1; } + /* Ensure text frames are NULL-terminated */ + if (f.frametype == AST_FRAME_TEXT && buf[res - 1] != '\0') { + if (res < sizeof(buf)) + buf[res++] = '\0'; + else /* Trims one character from the text message, but that's better than overwriting the end of the buffer. */ + buf[res - 1] = '\0'; + } f.datalen = res - sizeof(*fh); /* Handle implicit ACKing unless this is an INVAL, and only if this is |