]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_queue.c: Don't crash when realtime queue name is empty.
authorSean Bright <sean.bright@gmail.com>
Fri, 19 Mar 2021 20:57:44 +0000 (16:57 -0400)
committerJoshua Colp <jcolp@sangoma.com>
Mon, 22 Mar 2021 14:41:12 +0000 (09:41 -0500)
ASTERISK-27542 #close

Change-Id: If0b9719380a25533d2aed1053cff845dc3a4854a

apps/app_queue.c

index 334f41daf14098b343b05819ed74b9fac5386493..93bbdaa8b3f59f0e6ddac8db35fd5794fb24a6b8 100644 (file)
@@ -7704,6 +7704,10 @@ static int set_member_value(const char *queuename, const char *interface, int pr
                                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);
@@ -9788,6 +9792,10 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
                        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");
                                }