]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Avoid UBSan exception calling memcpy(,NULL,0) at startup.
authorChristophe Jaillet <jailletc36@apache.org>
Sat, 15 Feb 2020 14:22:22 +0000 (14:22 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Sat, 15 Feb 2020 14:22:22 +0000 (14:22 +0000)
Follow-up to r1874011 which did the same for the event MPM.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874055 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/worker/worker.c

index 60ec82b93ad02b296d7e1fa7a7d0e5e7a6198862..7c7a75cf0b862e436d9f984cc0554e03daeffa71 100644 (file)
@@ -1967,8 +1967,9 @@ static int worker_open_logs(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp,
             new_max = num_buckets;
         }
         new_ptr = (int *)apr_palloc(ap_pglobal, new_max * sizeof(int));
-        memcpy(new_ptr, retained->idle_spawn_rate,
-               retained->mpm->num_buckets * sizeof(int));
+        if (retained->idle_spawn_rate) /* NULL at startup */
+            memcpy(new_ptr, retained->idle_spawn_rate,
+                   etained->mpm->num_buckets * sizeof(int));
         retained->idle_spawn_rate = new_ptr;
         retained->mpm->max_buckets = new_max;
     }