diff options
author | Pedro Kiefer <pedro@kiefer.com.br> | 2012-11-29 16:44:42 +0000 |
---|---|---|
committer | Pedro Kiefer <pedro@kiefer.com.br> | 2012-11-29 16:44:42 +0000 |
commit | e46ea1fe6558e5af8a22c339aec313da3ba0f677 (patch) | |
tree | 13374e9648e25ba9db57e562f42c9c2ad73b08a5 | |
parent | 2686dde98b552db3796e63572bd468a54218313b (diff) |
Fix chan_sip websocket payload handling
Websocket by default doesn't return an ast_str for the payload received. When
converting it to an ast_str on chan_sip the last character was being omitted,
because ast_str functions expects that the given length includes the trailing
0x00. payload_len only has the actual string length without counting the
trailing zero.
For most cases this passed unnoticed as most of SIP messages ends with \r\n.
(closes issue ASTERISK-20745)
Reported by: IƱaki Baz Castillo
Review: https://reviewboard.asterisk.org/r/2219/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | channels/chan_sip.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 44c8037ba..67c2a1c7c 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2635,7 +2635,7 @@ static void sip_websocket_callback(struct ast_websocket *session, struct ast_var if (opcode == AST_WEBSOCKET_OPCODE_TEXT || opcode == AST_WEBSOCKET_OPCODE_BINARY) { struct sip_request req = { 0, }; - if (!(req.data = ast_str_create(payload_len))) { + if (!(req.data = ast_str_create(payload_len + 1))) { goto end; } |