File tree 2 files changed +11
-8
lines changed
2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? ??? 2022, PHP 8.0.21
4
4
5
+ - Core:
6
+ . Fixed potential use after free in php_binary_init(). (Heiko Weber)
7
+
5
8
- COM:
6
9
. Fixed bug GH-8778 (Integer arithmethic with large number variants fails).
7
10
(cmb)
Original file line number Diff line number Diff line change @@ -352,15 +352,15 @@ static void php_binary_init(void)
352
352
{
353
353
char * binary_location = NULL ;
354
354
#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 ;
359
359
}
360
360
#else
361
361
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 , '/' )) {
364
364
char * envpath , * path ;
365
365
int found = 0 ;
366
366
@@ -383,11 +383,11 @@ static void php_binary_init(void)
383
383
efree (path );
384
384
}
385
385
if (!found ) {
386
- free (binary_location );
386
+ pefree (binary_location , 1 );
387
387
binary_location = NULL ;
388
388
}
389
389
} 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 );
391
391
binary_location = NULL ;
392
392
}
393
393
}
You can’t perform that action at this time.
0 commit comments