]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
core/frame: generate correct T.140 payload in ast_sendtext_data()
authorneutrino88 <emmanuel.buu@ives.fr>
Wed, 3 Oct 2018 21:51:49 +0000 (17:51 -0400)
committerneutrino88 <emmanuel.buu@ives.fr>
Thu, 4 Oct 2018 07:34:16 +0000 (03:34 -0400)
ast_sendtext_data() would create an incorrect T.140 text frame which
length include the null terminator byte. It causes ultimately RTP
packets to be send with this trailing 0. The proposed fix just set the
correct length to the text frame

ASTERISK-28089
Reported by: Emmanuel BUU
Tested by: Emmanuel BUU

Change-Id: I7ab1b9ed1e21683b2b667ea0a59d9aba3c77dd96

main/channel.c

index 5fc9cd83a3c1dbd677d48de0a54375817c9610ca..d13d3f5f8e7ab6ca1f08031df11c7e11e7091461 100644 (file)
@@ -4905,7 +4905,8 @@ int ast_sendtext_data(struct ast_channel *chan, struct ast_msg_data *msg)
                && (ast_strlen_zero(content_type) || ast_begins_with(content_type, "text/"))
                && (ast_format_cap_has_type(ast_channel_nativeformats(chan), AST_MEDIA_TYPE_TEXT))) {
                struct ast_frame f;
-               size_t body_len = strlen(body) + 1;
+               /* T.140 payload does not include the null byte terminator */
+               size_t body_len = strlen(body);
 
                /* Process as T.140 text (moved here from ast_sendtext() */
                memset(&f, 0, sizeof(f));