File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 9
9
extension code. (Sara)
10
10
. Fixed bug GH-8655 (Casting an object to array does not unwrap refcount=1
11
11
references). (Nicolas Grekas)
12
+ . Fixed potential use after free in php_binary_init(). (Heiko Weber)
12
13
13
14
- COM:
14
15
. Fixed bug GH-8778 (Integer arithmethic with large number variants fails).
Original file line number Diff line number Diff line change @@ -348,15 +348,15 @@ static void php_binary_init(void)
348
348
{
349
349
char * binary_location = NULL ;
350
350
#ifdef PHP_WIN32
351
- binary_location = (char * )malloc (MAXPATHLEN );
352
- if (binary_location && GetModuleFileName (0 , binary_location , MAXPATHLEN ) == 0 ) {
353
- free (binary_location );
354
- PG ( php_binary ) = NULL ;
351
+ binary_location = (char * )pemalloc (MAXPATHLEN , 1 );
352
+ if (GetModuleFileName (0 , binary_location , MAXPATHLEN ) == 0 ) {
353
+ pefree (binary_location , 1 );
354
+ binary_location = NULL ;
355
355
}
356
356
#else
357
357
if (sapi_module .executable_location ) {
358
- binary_location = (char * )malloc (MAXPATHLEN );
359
- if (binary_location && !strchr (sapi_module .executable_location , '/' )) {
358
+ binary_location = (char * )pemalloc (MAXPATHLEN , 1 );
359
+ if (!strchr (sapi_module .executable_location , '/' )) {
360
360
char * envpath , * path ;
361
361
int found = 0 ;
362
362
@@ -379,11 +379,11 @@ static void php_binary_init(void)
379
379
efree (path );
380
380
}
381
381
if (!found ) {
382
- free (binary_location );
382
+ pefree (binary_location , 1 );
383
383
binary_location = NULL ;
384
384
}
385
385
} else if (!VCWD_REALPATH (sapi_module .executable_location , binary_location ) || VCWD_ACCESS (binary_location , X_OK )) {
386
- free (binary_location );
386
+ pefree (binary_location , 1 );
387
387
binary_location = NULL ;
388
388
}
389
389
}
You can’t perform that action at this time.
0 commit comments