diff options
| author | Uwe Schindler <thetaphi@php.net> | 2004-06-26 10:30:07 +0000 |
|---|---|---|
| committer | Uwe Schindler <thetaphi@php.net> | 2004-06-26 10:30:07 +0000 |
| commit | 3bb7e736562f2680f9e8b42727fa15aec864f3a7 (patch) | |
| tree | 5a0f9d2e167e6e9e999d6c000a813deabc4db235 /sapi | |
| parent | 59d55efb17f7a6b90a464d80c1e0dda890a8c5dd (diff) | |
| download | php-git-3bb7e736562f2680f9e8b42727fa15aec864f3a7.tar.gz | |
replace strncpy with strlcpy
Diffstat (limited to 'sapi')
| -rw-r--r-- | sapi/nsapi/nsapi.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c index ca010e5986..84a3c1bfaa 100644 --- a/sapi/nsapi/nsapi.c +++ b/sapi/nsapi/nsapi.c @@ -604,7 +604,7 @@ static void sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_D while (entry) { if (!PG(safe_mode) || strncasecmp(entry->param->name, "authorization", 13)) { if (strcasecmp(entry->param->name, "content-length")==0 || strcasecmp(entry->param->name, "content-type")==0) { - strncpy(buf, entry->param->name, NS_BUF_SIZE); + strlcpy(buf, entry->param->name, NS_BUF_SIZE); pos = 0; } else { snprintf(buf, NS_BUF_SIZE, "HTTP_%s", entry->param->name); @@ -672,8 +672,7 @@ static void sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_D /* Create full Request-URI & Script-Name */ if (SG(request_info).request_uri) { - strncpy(buf, SG(request_info).request_uri, NS_BUF_SIZE); - buf[NS_BUF_SIZE]='\0'; + strlcpy(buf, SG(request_info).request_uri, NS_BUF_SIZE); if (SG(request_info).query_string) { p = strchr(buf, 0); snprintf(p, NS_BUF_SIZE-(p-buf), "?%s", SG(request_info).query_string); @@ -681,8 +680,7 @@ static void sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_D } php_register_variable("REQUEST_URI", buf, track_vars_array TSRMLS_CC); - strncpy(buf, SG(request_info).request_uri, NS_BUF_SIZE); - buf[NS_BUF_SIZE]='\0'; + strlcpy(buf, SG(request_info).request_uri, NS_BUF_SIZE); if (rc->path_info) { pos = strlen(SG(request_info).request_uri) - strlen(rc->path_info); if (pos>=0 && pos<=NS_BUF_SIZE && rc->path_info) { |
