From: Sascha Schumann Date: Thu, 30 Mar 2000 12:55:59 +0000 (+0000) Subject: Allocate enough memory for additional /. X-Git-Tag: php-4.0RC2~573 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe92fef608784ec3d28678aafa51a24985c41e87;p=php 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 --- 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); }