[Asterisk-code-review] res pjsip: Fail global load if debug or default from user a... (asterisk[13])

Anonymous Coward asteriskteam at digium.com
Fri Aug 12 18:49:54 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: res_pjsip:  Fail global load if debug or default_from_user are empty
......................................................................


res_pjsip:  Fail global load if debug or default_from_user are empty

If debug was specified in the global configuration but left blank,
the logger would treat it as a wildcard and log all hosts.  If
default_from_user was empty, a crash would result.

The global apply handler now checks for empty strings.

ASTERISK-26239 #close
ASTERISK-26238 #close

Change-Id: Ie75727f5cd5808845d92cc81f5713842fb203336
---
M res/res_pjsip/config_global.c
1 file changed, 12 insertions(+), 0 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_pjsip/config_global.c b/res/res_pjsip/config_global.c
index 8a1b0d4..975c5ee 100644
--- a/res/res_pjsip/config_global.c
+++ b/res/res_pjsip/config_global.c
@@ -118,6 +118,18 @@
 	struct global_config *cfg = obj;
 	char max_forwards[10];
 
+	if (ast_strlen_zero(cfg->debug)) {
+		ast_log(LOG_ERROR,
+			"Global option 'debug' can't be empty.  Set it to a valid value or remove the entry to accept 'no' as the default\n");
+		return -1;
+	}
+
+	if (ast_strlen_zero(cfg->default_from_user)) {
+		ast_log(LOG_ERROR,
+			"Global option 'default_from_user' can't be empty.  Set it to a valid value or remove the entry to accept 'asterisk' as the default\n");
+		return -1;
+	}
+
 	snprintf(max_forwards, sizeof(max_forwards), "%u", cfg->max_forwards);
 
 	ast_sip_add_global_request_header("Max-Forwards", max_forwards, 1);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie75727f5cd5808845d92cc81f5713842fb203336
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list