cvs: /php4/ext/standard dl.c

From: Date: Tue, 07 Mar 2000 03:43:33 +0000
Subject: cvs: /php4/ext/standard dl.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-11656@lists.php.net to get a copy of this message
thies Mon Mar 6 19:43:33 2000 EDT Modified files: /php4/ext/standard dl.c Log: (php: dl) fixed MAXPATHLEN bug # now it's /* SAFE */ ! Index: php4/ext/standard/dl.c diff -u php4/ext/standard/dl.c:1.26 php4/ext/standard/dl.c:1.27 --- php4/ext/standard/dl.c:1.26 Mon Mar 6 12:37:11 2000 +++ php4/ext/standard/dl.c Mon Mar 6 19:43:03 2000 @@ -73,7 +73,7 @@ void php_dl(pval *file,int type,pval *return_value) { void *handle; - char libpath[MAXPATHLEN + 1]; + char *libpath; zend_module_entry *module_entry,*tmp; zend_module_entry *(*get_module)(void); PLS_FETCH(); @@ -84,13 +84,15 @@ && PG(extension_dir)[0]){ int extension_dir_len = strlen(PG(extension_dir)); + libpath = emalloc(extension_dir_len+strlen(file->value.str.val)+1); + 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); /* SAFE */ + sprintf(libpath,"%s%s",PG(extension_dir),file->value.str.val); } else { - sprintf(libpath,"%s/%s",PG(extension_dir),file->value.str.val); /* SAFE */ + sprintf(libpath,"%s/%s",PG(extension_dir),file->value.str.val); } } else { - sprintf(libpath,"%s",file->value.str.val); /* SAFE */ + libpath = estrdup(file->value.str.val); } /* load dynamic symbol */ @@ -108,8 +110,14 @@ #else php_error(error_type,"Unable to load dynamic library '%s' - %s",libpath,dlerror()); #endif + + efree(libpath); + RETURN_FALSE; } + + efree(libpath); + get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module"); if (!get_module) {

« previous php.version4 (#11656) next »