You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2020/02/15 14:22:23 UTC

svn commit: r1874055 - /httpd/httpd/trunk/server/mpm/worker/worker.c

Author: jailletc36
Date: Sat Feb 15 14:22:22 2020
New Revision: 1874055

URL: http://svn.apache.org/viewvc?rev=1874055&view=rev
Log:
Avoid UBSan exception  calling memcpy(,NULL,0) at startup.

Follow-up to r1874011 which did the same for the event MPM.

Modified:
    httpd/httpd/trunk/server/mpm/worker/worker.c

Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1874055&r1=1874054&r2=1874055&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Sat Feb 15 14:22:22 2020
@@ -1967,8 +1967,9 @@ static int worker_open_logs(apr_pool_t *
             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;
     }