@@ -4132,7 +4132,7 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
4132
4132
return SUCCESS ;
4133
4133
}
4134
4134
/* strip .. from path and restrict it to be under dest directory */
4135
- new_state .cwd = (char * )malloc (2 );
4135
+ new_state .cwd = (char * )emalloc (2 );
4136
4136
new_state .cwd [0 ] = DEFAULT_SLASH ;
4137
4137
new_state .cwd [1 ] = '\0' ;
4138
4138
new_state .cwd_length = 1 ;
@@ -4145,7 +4145,7 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
4145
4145
} else {
4146
4146
spprintf (error , 4096 , "Cannot extract \"%s\", internal error" , entry -> filename );
4147
4147
}
4148
- free (new_state .cwd );
4148
+ efree (new_state .cwd );
4149
4149
return FAILURE ;
4150
4150
}
4151
4151
filename = new_state .cwd + 1 ;
@@ -4177,29 +4177,29 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
4177
4177
spprintf (error , 4096 , "Cannot extract \"%s\" to \"%s...\", extracted filename is too long for filesystem" , entry -> filename , fullpath );
4178
4178
}
4179
4179
efree (fullpath );
4180
- free (new_state .cwd );
4180
+ efree (new_state .cwd );
4181
4181
return FAILURE ;
4182
4182
}
4183
4183
4184
4184
if (!len ) {
4185
4185
spprintf (error , 4096 , "Cannot extract \"%s\", internal error" , entry -> filename );
4186
4186
efree (fullpath );
4187
- free (new_state .cwd );
4187
+ efree (new_state .cwd );
4188
4188
return FAILURE ;
4189
4189
}
4190
4190
4191
4191
if (PHAR_OPENBASEDIR_CHECKPATH (fullpath )) {
4192
4192
spprintf (error , 4096 , "Cannot extract \"%s\" to \"%s\", openbasedir/safe mode restrictions in effect" , entry -> filename , fullpath );
4193
4193
efree (fullpath );
4194
- free (new_state .cwd );
4194
+ efree (new_state .cwd );
4195
4195
return FAILURE ;
4196
4196
}
4197
4197
4198
4198
/* let see if the path already exists */
4199
4199
if (!overwrite && SUCCESS == php_stream_stat_path (fullpath , & ssb )) {
4200
4200
spprintf (error , 4096 , "Cannot extract \"%s\" to \"%s\", path already exists" , entry -> filename , fullpath );
4201
4201
efree (fullpath );
4202
- free (new_state .cwd );
4202
+ efree (new_state .cwd );
4203
4203
return FAILURE ;
4204
4204
}
4205
4205
@@ -4237,7 +4237,7 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
4237
4237
}
4238
4238
4239
4239
filename = NULL ;
4240
- free (new_state .cwd );
4240
+ efree (new_state .cwd );
4241
4241
/* it is a standalone directory, job done */
4242
4242
if (entry -> is_dir ) {
4243
4243
efree (fullpath );
0 commit comments