[Asterisk-code-review] app_queue.c: Don't crash when realtime queue name is empty. (asterisk[18])

Joshua Colp asteriskteam at digium.com
Mon Mar 22 09:41:44 CDT 2021


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

Change subject: app_queue.c: Don't crash when realtime queue name is empty.
......................................................................

app_queue.c: Don't crash when realtime queue name is empty.

ASTERISK-27542 #close

Change-Id: If0b9719380a25533d2aed1053cff845dc3a4854a
---
M apps/app_queue.c
1 file changed, 8 insertions(+), 0 deletions(-)

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



diff --git a/apps/app_queue.c b/apps/app_queue.c
index e84247d..153fe6b 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -7697,6 +7697,10 @@
 				char *category = NULL;
 				while ((category = ast_category_browse(queue_config, category))) {
 					const char *name = ast_variable_retrieve(queue_config, category, "name");
+					if (ast_strlen_zero(name)) {
+						ast_log(LOG_WARNING, "Ignoring realtime queue with a NULL or empty 'name.'\n");
+						continue;
+					}
 					if ((q = find_load_queue_rt_friendly(name))) {
 						foundqueue++;
 						foundinterface += set_member_value_help_members(q, interface, property, value);
@@ -9793,6 +9797,10 @@
 			char *category = NULL;
 			while ((category = ast_category_browse(cfg, category))) {
 				const char *queuename = ast_variable_retrieve(cfg, category, "name");
+				if (ast_strlen_zero(queuename)) {
+					ast_log(LOG_WARNING, "Ignoring realtime queue with a NULL or empty 'name.'\n");
+					continue;
+				}
 				if ((q = find_load_queue_rt_friendly(queuename))) {
 					queue_t_unref(q, "Done with temporary pointer");
 				}

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

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: If0b9719380a25533d2aed1053cff845dc3a4854a
Gerrit-Change-Number: 15659
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210322/386e5464/attachment.html>


More information about the asterisk-code-review mailing list