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

Sean Bright asteriskteam at digium.com
Fri Mar 19 20:11:08 CDT 2021


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/15660 )


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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/60/15660/1

diff --git a/apps/app_queue.c b/apps/app_queue.c
index eddf5c7..d4adb6f 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/+/15660
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: If0b9719380a25533d2aed1053cff845dc3a4854a
Gerrit-Change-Number: 15660
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210319/4e87c4a5/attachment.html>


More information about the asterisk-code-review mailing list