[Asterisk-code-review] res parking: Fix crash if ATTENDEDTRANSFER set empty before ... (asterisk[13])

Matt Jordan asteriskteam at digium.com
Thu Jul 16 20:32:21 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: res_parking: Fix crash if ATTENDEDTRANSFER set empty before Park.
......................................................................


res_parking: Fix crash if ATTENDEDTRANSFER set empty before Park.

setup_park_common_datastore() was assuming that a non-NULL string returned
for the ATTENDEDTRANSFER and BLINDTRANSFER channel variables are not empty
strings.  Things got crashy as a result.

* Made setup_park_common_datastore() treat the channel variable values the
same whether they are NULL or empty for ATTENDEDTRANSFER and
BLINDTRANSFER.

ASTERISK-25254 #close
Reported by: Richard Mudgett

Change-Id: I9a9c174b33f354f35f82cc6b7cea8303adbaf9c2
---
M res/parking/parking_applications.c
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved



diff --git a/res/parking/parking_applications.c b/res/parking/parking_applications.c
index 22ae9c4..9446f2f 100644
--- a/res/parking/parking_applications.c
+++ b/res/parking/parking_applications.c
@@ -349,8 +349,12 @@
 	attended_transfer = pbx_builtin_getvar_helper(parkee, "ATTENDEDTRANSFER");
 	blind_transfer = pbx_builtin_getvar_helper(parkee, "BLINDTRANSFER");
 
-	if (attended_transfer || blind_transfer) {
-		parker_dial_string = ast_strdupa(S_OR(attended_transfer, blind_transfer));
+	if (!ast_strlen_zero(attended_transfer)) {
+		parker_dial_string = ast_strdupa(attended_transfer);
+	} else if (!ast_strlen_zero(blind_transfer)) {
+		parker_dial_string = ast_strdupa(blind_transfer);
+		/* Ensure that attended_transfer is NULL and not an empty string. */
+		attended_transfer = NULL;
 	}
 
 	ast_channel_unlock(parkee);

-- 
To view, visit https://gerrit.asterisk.org/912
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9a9c174b33f354f35f82cc6b7cea8303adbaf9c2
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list