[Asterisk-code-review] res_ari_channels: Fixed endpoint 80 characters limit (asterisk[master])

Joshua Colp asteriskteam at digium.com
Wed Apr 22 16:07:23 CDT 2020


Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14279 )

Change subject: res_ari_channels: Fixed endpoint 80 characters limit
......................................................................

res_ari_channels: Fixed endpoint 80 characters limit

Fixed it to copy the entire string from the requested endpoint body except tech-prefix.

ASTERISK-28847

Change-Id: I91b5f6708a1200363f3267b847dd6a0915222c25
---
M res/ari/resource_channels.c
1 file changed, 11 insertions(+), 4 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  Kevin Harwell: Looks good to me, approved
  Richard Mudgett: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve



diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 549883d..eaff90f 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -1077,7 +1077,7 @@
 	struct ast_ari_response *response)
 {
 	char *dialtech;
-	char dialdevice[AST_CHANNEL_NAME];
+	char *dialdevice = NULL;
 	struct ast_dial *dial;
 	char *caller_id = NULL;
 	char *cid_num = NULL;
@@ -1116,7 +1116,7 @@
 	dialtech = ast_strdupa(args_endpoint);
 	if ((stuff = strchr(dialtech, '/'))) {
 		*stuff++ = '\0';
-		ast_copy_string(dialdevice, stuff, sizeof(dialdevice));
+		dialdevice = stuff;
 	}
 
 	if (ast_strlen_zero(dialtech) || ast_strlen_zero(dialdevice)) {
@@ -1787,7 +1787,7 @@
 	struct ast_channel_snapshot *snapshot;
 	pthread_t thread;
 	char *dialtech;
-	char dialdevice[AST_CHANNEL_NAME];
+	char *dialdevice = NULL;
 	char *stuff;
 	int cause;
 	struct ast_format_cap *request_cap;
@@ -1826,7 +1826,14 @@
 	dialtech = ast_strdupa(args->endpoint);
 	if ((stuff = strchr(dialtech, '/'))) {
 		*stuff++ = '\0';
-		ast_copy_string(dialdevice, stuff, sizeof(dialdevice));
+		dialdevice = stuff;
+	}
+
+	if (ast_strlen_zero(dialtech) || ast_strlen_zero(dialdevice)) {
+		ast_ari_response_error(response, 400, "Bad Request",
+			"Invalid endpoint specified");
+		chan_data_destroy(chan_data);
+		return;
 	}
 
 	originator = ast_channel_get_by_name(args->originator);

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I91b5f6708a1200363f3267b847dd6a0915222c25
Gerrit-Change-Number: 14279
Gerrit-PatchSet: 4
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-CC: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200422/8d626e40/attachment.html>


More information about the asterisk-code-review mailing list