summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-06-09 00:43:43 +0000
committerZeev Suraski <zeev@php.net>2000-06-09 00:43:43 +0000
commit2ffa48b447c2f0efd4265a197581e435b81bc3a2 (patch)
treee79726ee6c05e3ba739f7d38cc7ba3cc5b869725
parentfb330f795d09217b6f3bb714fda171e7c06bb222 (diff)
downloadphp-git-2ffa48b447c2f0efd4265a197581e435b81bc3a2.tar.gz
Restore the check for the trailing slash. Windows does not apply s#/+#/# (PR 4375)
-rw-r--r--ext/standard/dl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index 1054bdd2f5..978ae54e90 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -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);
}