mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Restore the check for the trailing slash. Windows does not apply s#/+#/# (PR 4375)
This commit is contained in:
parent
fb330f795d
commit
2ffa48b447
@ -75,6 +75,9 @@ PHP_FUNCTION(dl)
|
||||
#define USING_ZTS 0
|
||||
#endif
|
||||
|
||||
#define IS_SLASH(c) \
|
||||
(((c)=='/') || ((c)=='\\'))
|
||||
|
||||
void php_dl(pval *file,int type,pval *return_value)
|
||||
{
|
||||
void *handle;
|
||||
@ -89,7 +92,11 @@ void php_dl(pval *file,int type,pval *return_value)
|
||||
|
||||
libpath = emalloc(extension_dir_len+file->value.str.len+2);
|
||||
|
||||
sprintf(libpath,"%s/%s",PG(extension_dir),file->value.str.val);
|
||||
if (IS_SLASH(PG(extension_dir)[extension_dir_len-1])) {
|
||||
sprintf(libpath,"%s%s", PG(extension_dir), file->value.str.val); /* SAFE */
|
||||
} else {
|
||||
sprintf(libpath,"%s/%s", PG(extension_dir), file->value.str.val); /* SAFE */
|
||||
}
|
||||
} else {
|
||||
libpath = estrndup(file->value.str.val, file->value.str.len);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user