mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
Allocate enough memory for additional /.
Also remove the extra check for the trailing /. Unix will automatically apply s#/+#/# Partly suggested by: drew@elysium.ltd.uk PR: #3956
This commit is contained in:
parent
0ccbd9d9ec
commit
fe92fef608
1 changed files with 2 additions and 6 deletions
|
@ -88,13 +88,9 @@ void php_dl(pval *file,int type,pval *return_value)
|
|||
&& PG(extension_dir)[0]){
|
||||
int extension_dir_len = strlen(PG(extension_dir));
|
||||
|
||||
libpath = emalloc(extension_dir_len+file->value.str.len+1);
|
||||
libpath = emalloc(extension_dir_len+file->value.str.len+2);
|
||||
|
||||
if (PG(extension_dir)[extension_dir_len-1]=='/' || PG(extension_dir)[extension_dir_len-1]=='\\') {
|
||||
sprintf(libpath,"%s%s",PG(extension_dir),file->value.str.val);
|
||||
} else {
|
||||
sprintf(libpath,"%s/%s",PG(extension_dir),file->value.str.val);
|
||||
}
|
||||
} else {
|
||||
libpath = estrndup(file->value.str.val, file->value.str.len);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue