Add bounds check for max_queue_size
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 17 Sep 2012 12:42:51 +0000 (13:42 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 17 Sep 2012 12:42:51 +0000 (13:42 +0100)
src/main/threads.c

index fa8771d..99ac6ea 100644 (file)
@@ -803,6 +803,10 @@ int thread_pool_init(CONF_SECTION *cs, int *spawn_flag)
                thread_pool.max_spare_threads = 1;
        if (thread_pool.max_spare_threads < thread_pool.min_spare_threads)
                thread_pool.max_spare_threads = thread_pool.min_spare_threads;
+       if ((thread_pool.max_queue_size < 2) || (thread_pool.max_queue_size > 1048576)) {
+               radlog(L_ERR, "FATAL: max_queue_size value must be in range 2-1048576");
+               return -1;
+       }
 
        /*
         *      The pool has already been initialized.  Don't spawn