cvs: php4(PHP_4_3) /sapi/cgi cgi_main.c
| From: | Moriyoshi Koizumi | Date: | Fri, 28 Mar 2003 18:25:01 +0000 |
| Subject: | cvs: php4(PHP_4_3) /sapi/cgi cgi_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-19824@lists.php.net to get a copy of this message | ||
moriyoshi Fri Mar 28 13:25:01 2003 EDT
Modified files: (Branch: PHP_4_3)
/php4/sapi/cgi cgi_main.c
Log:
MFH(r-1.222): do the right fix..
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.190.2.20 php4/sapi/cgi/cgi_main.c:1.190.2.21
--- php4/sapi/cgi/cgi_main.c:1.190.2.20 Fri Mar 28 12:55:08 2003
+++ php4/sapi/cgi/cgi_main.c Fri Mar 28 13:25:01 2003
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cgi_main.c,v 1.190.2.20 2003/03/28 17:55:08 moriyoshi Exp $ */
+/* $Id: cgi_main.c,v 1.190.2.21 2003/03/28 18:25:01 moriyoshi Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -368,7 +368,10 @@
char *buf = NULL;
if (!name) return NULL;
len = strlen(name) + (value?strlen(value):0) + sizeof("=") + 2;
- buf = (char *)emalloc(len);
+ buf = (char *)malloc(len);
+ if (buf == NULL) {
+ return getenv(name);
+ }
if (value) {
snprintf(buf,len-1,"%s=%s", name, value);
} else {
@@ -382,7 +385,7 @@
if (!FCGX_IsCGI()) {
FCGX_Request *request = (FCGX_Request *)SG(server_context);
FCGX_PutEnv(request,buf);
- efree(buf);
+ free(buf);
return sapi_cgibin_getenv(name,0 TSRMLS_CC);
}
#endif
@@ -391,11 +394,7 @@
this leaks, but it's only cgi anyway, we'll fix
it for 5.0
*/
- if (value)
- putenv(strdup(buf));
- else
- putenv(buf);
- efree(buf);
+ putenv(buf);
return getenv(name);
}
@@ -787,8 +786,8 @@
} else {
/* make sure path_info/translated are empty */
script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME",script_path_translated
TSRMLS_CC);
- _sapi_cgibin_putenv("PATH_INFO", "" TSRMLS_CC);
- _sapi_cgibin_putenv("PATH_TRANSLATED", "" TSRMLS_CC);
+ _sapi_cgibin_putenv("PATH_INFO", NULL TSRMLS_CC);
+ _sapi_cgibin_putenv("PATH_TRANSLATED", NULL TSRMLS_CC);
}
SG(request_info).request_uri = sapi_cgibin_getenv("SCRIPT_NAME",0 TSRMLS_CC);
} else {