File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 22|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33?? ??? 2022, PHP 8.0.21
44
5+ - Core:
6+ . Fixed potential use after free in php_binary_init(). (Heiko Weber)
7+
58- COM:
69 . Fixed bug GH-8778 (Integer arithmethic with large number variants fails).
710 (cmb)
Original file line number Diff line number Diff line change @@ -352,15 +352,15 @@ static void php_binary_init(void)
352352{
353353 char * binary_location = NULL ;
354354#ifdef PHP_WIN32
355- binary_location = (char * )malloc (MAXPATHLEN );
356- if (binary_location && GetModuleFileName (0 , binary_location , MAXPATHLEN ) == 0 ) {
357- free (binary_location );
358- PG ( php_binary ) = NULL ;
355+ binary_location = (char * )pemalloc (MAXPATHLEN , 1 );
356+ if (GetModuleFileName (0 , binary_location , MAXPATHLEN ) == 0 ) {
357+ pefree (binary_location , 1 );
358+ binary_location = NULL ;
359359 }
360360#else
361361 if (sapi_module .executable_location ) {
362- binary_location = (char * )malloc (MAXPATHLEN );
363- if (binary_location && !strchr (sapi_module .executable_location , '/' )) {
362+ binary_location = (char * )pemalloc (MAXPATHLEN , 1 );
363+ if (!strchr (sapi_module .executable_location , '/' )) {
364364 char * envpath , * path ;
365365 int found = 0 ;
366366
@@ -383,11 +383,11 @@ static void php_binary_init(void)
383383 efree (path );
384384 }
385385 if (!found ) {
386- free (binary_location );
386+ pefree (binary_location , 1 );
387387 binary_location = NULL ;
388388 }
389389 } else if (!VCWD_REALPATH (sapi_module .executable_location , binary_location ) || VCWD_ACCESS (binary_location , X_OK )) {
390- free (binary_location );
390+ pefree (binary_location , 1 );
391391 binary_location = NULL ;
392392 }
393393 }
You can’t perform that action at this time.
0 commit comments