From fe92fef608784ec3d28678aafa51a24985c41e87 Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Thu, 30 Mar 2000 12:55:59 +0000 Subject: [PATCH] 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 --- ext/standard/dl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ext/standard/dl.c b/ext/standard/dl.c index 08041e548c..a06c7bb77d 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -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); - } + sprintf(libpath,"%s/%s",PG(extension_dir),file->value.str.val); } else { libpath = estrndup(file->value.str.val, file->value.str.len); } -- 2.50.1