]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_queue: Add NULL pointer checks in app_queue
authorphoneben <67923255+phoneben@users.noreply.github.com>
Thu, 11 Sep 2025 17:31:30 +0000 (20:31 +0300)
committerphoneben <67923255+phoneben@users.noreply.github.com>
Mon, 22 Sep 2025 17:19:16 +0000 (17:19 +0000)
Add NULL check for word_list before calling word_in_list()
Add NULL checks for channel snapshots from ast_multi_channel_blob_get_channel()

Resolves: #1425

apps/app_queue.c

index a9d8d2495af1060eba50f7f121ab075a88ca5a46..234204a8db733ff63214d2838829ae8a19d31a4e 100644 (file)
@@ -6789,7 +6789,15 @@ static void handle_local_optimization_begin(void *userdata, struct stasis_subscr
        struct local_optimization *optimization;
        unsigned int id;
        SCOPED_AO2LOCK(lock, queue_data);
-
+       
+       if (!local_one || !local_two || !source) {
+               ast_debug(1, "Local optimization begin missing channel snapshots:%s%s%s\n",
+               !local_one ? " local_one," : "",
+               !local_two ? " local_two," : "", 
+               !source ? " source," : "");
+               return;
+       }
+       
        if (queue_data->dying) {
                return;
        }
@@ -10685,7 +10693,7 @@ static char *complete_queue(const char *line, const char *word, int pos, int sta
        queue_iter = ao2_iterator_init(queues, 0);
        while ((q = ao2_t_iterator_next(&queue_iter, "Iterate through queues"))) {
                if (!strncasecmp(word, q->name, wordlen) && ++which > state
-                       && (!word_list_offset || !word_in_list(word_list, q->name))) {
+                       && (!word_list_offset || !word_list || !word_in_list(word_list, q->name))) {
                        ret = ast_strdup(q->name);
                        queue_t_unref(q, "Done with iterator");
                        break;