mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
(php_ns_hash_environment) Ns_ConnHost() may return NULL, check for it
This commit is contained in:
parent
63a3e9ac45
commit
fc95f04b10
1 changed files with 6 additions and 2 deletions
|
@ -300,6 +300,7 @@ php_ns_hash_environment(NSLS_D CLS_DC ELS_DC PLS_DC SLS_DC)
|
|||
int i;
|
||||
char buf[NS_BUF_SIZE + 1];
|
||||
zval *pval;
|
||||
char *tmp;
|
||||
|
||||
for(i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) {
|
||||
char *key = Ns_SetKey(NSG(conn->headers), i);
|
||||
|
@ -352,8 +353,11 @@ php_ns_hash_environment(NSLS_D CLS_DC ELS_DC PLS_DC SLS_DC)
|
|||
snprintf(buf, NS_BUF_SIZE, "%d", Ns_ConnPort(NSG(conn)));
|
||||
ADD_STRING("SERVER_PORT");
|
||||
|
||||
strncpy(buf, Ns_ConnHost(NSG(conn)), NS_BUF_SIZE);
|
||||
ADD_STRING("SERVER_NAME");
|
||||
tmp = Ns_ConnHost(NSG(conn));
|
||||
if (tmp) {
|
||||
strncpy(buf, tmp, NS_BUF_SIZE);
|
||||
ADD_STRING("SERVER_NAME");
|
||||
}
|
||||
|
||||
strncpy(buf, SG(request_info).path_translated, NS_BUF_SIZE);
|
||||
ADD_STRING("PATH_TRANSLATED");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue