]> granicus.if.org Git - php/commitdiff
replace strncpy with strlcpy
authorUwe Schindler <thetaphi@php.net>
Sat, 26 Jun 2004 10:30:07 +0000 (10:30 +0000)
committerUwe Schindler <thetaphi@php.net>
Sat, 26 Jun 2004 10:30:07 +0000 (10:30 +0000)
sapi/nsapi/nsapi.c

index ca010e59869c66d39ea4fa918c1ebd408616c3a6..84a3c1bfaa6ac83a58fed01f8f10bcf05fbc730c 100644 (file)
@@ -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) {