[Asterisk-code-review] core/briding: correct crash case when bridge relay an empty ... (asterisk[13])

Emmanuel BUU asteriskteam at digium.com
Tue Sep 25 17:13:08 CDT 2018


Emmanuel BUU has uploaded this change for review. ( https://gerrit.asterisk.org/10269


Change subject: core/briding: correct crash case when bridge relay an empty text frame
......................................................................

core/briding: correct crash case when bridge relay an empty text frame

If a channel creates a AST_TEXT_FRAME with datalen == 0 and an invalid
dataptr, it causes a crash. The proposed fix is not to call sendtext
on such frames. It is not entirely transparent (it removes empty text
frames from the communication)

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

Change-Id: Ib882dd028598f13c4c233edbfdd7e54ad44a68e9
---
M main/bridge_channel.c
1 file changed, 4 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/69/10269/1

diff --git a/main/bridge_channel.c b/main/bridge_channel.c
index 1a7df87..2e53d13 100644
--- a/main/bridge_channel.c
+++ b/main/bridge_channel.c
@@ -2362,9 +2362,11 @@
 	case AST_FRAME_NULL:
 		break;
 	case AST_FRAME_TEXT:
-		ast_debug(1, "Sending TEXT frame to '%s': %*.s\n",
+		if  (fr->datalen > 0) {
+			ast_debug(1, "Sending TEXT frame to '%s': %*.s\n",
 			ast_channel_name(bridge_channel->chan), fr->datalen, (char *)fr->data.ptr);
-		ast_sendtext(bridge_channel->chan, fr->data.ptr);
+			ast_sendtext(bridge_channel->chan, fr->data.ptr);
+		}
 		break;
 	case AST_FRAME_TEXT_DATA:
 		msg = (struct ast_msg_data *)fr->data.ptr;

-- 
To view, visit https://gerrit.asterisk.org/10269
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib882dd028598f13c4c233edbfdd7e54ad44a68e9
Gerrit-Change-Number: 10269
Gerrit-PatchSet: 1
Gerrit-Owner: Emmanuel BUU <emmanuel.buu at ives.fr>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180925/21eb458b/attachment-0001.html>


More information about the asterisk-code-review mailing list