[Asterisk-code-review] stasis: Allow empty application arguments to move. (...asterisk[13])

Joshua C. Colp asteriskteam at digium.com
Wed Mar 13 11:33:38 CDT 2019


Joshua C. Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11143 )

Change subject: stasis: Allow empty application arguments to move.
......................................................................

stasis: Allow empty application arguments to move.

Change-Id: I1e4d37415f3034abe36496dc30209c2303e6af5c
---
M res/stasis/control.c
1 file changed, 8 insertions(+), 3 deletions(-)

Approvals:
  Corey Farrell: Looks good to me, but someone else must approve
  Sean Bright: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Joshua C. Colp: Approved for Submit



diff --git a/res/stasis/control.c b/res/stasis/control.c
index 05f2fd3..4e2490d 100644
--- a/res/stasis/control.c
+++ b/res/stasis/control.c
@@ -525,16 +525,21 @@
 	struct stasis_app_control_move_data *move_data;
 	size_t size;
 
-	size = sizeof(*move_data) + strlen(app_name) + strlen(app_args) + 2;
+	size = sizeof(*move_data) + strlen(app_name) + 1;
+	if (app_args) {
+		/* Application arguments are optional */
+		size += strlen(app_args) + 1;
+	}
+
 	if (!(move_data = ast_calloc(1, size))) {
 		return -1;
 	}
 
 	move_data->app_name = (char *)move_data + sizeof(*move_data);
-	move_data->app_args = move_data->app_name + strlen(app_name) + 1;
-
 	strcpy(move_data->app_name, app_name); /* Safe */
+
 	if (app_args) {
+		move_data->app_args = move_data->app_name + strlen(app_name) + 1;
 		strcpy(move_data->app_args, app_args); /* Safe */
 	} else {
 		move_data->app_args = NULL;

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I1e4d37415f3034abe36496dc30209c2303e6af5c
Gerrit-Change-Number: 11143
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua C. Colp <jcolp at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua C. Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: 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/20190313/4c0dd6b9/attachment.html>


More information about the asterisk-code-review mailing list