summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2007-02-24 16:25:58 +0000
committerMarcus Boerger <helly@php.net>2007-02-24 16:25:58 +0000
commit20a40063c51b20c1ea5f48c109b69fea3964b446 (patch)
tree24d6bf7894cc8080ff86f16eb5efef9da1cdf9c7 /sapi
parent10ffce328593ddda1fb31482ec5d19ce6e02556d (diff)
downloadphp-git-20a40063c51b20c1ea5f48c109b69fea3964b446.tar.gz
- avoid sprintf
Diffstat (limited to 'sapi')
-rw-r--r--sapi/nsapi/nsapi.c4
-rw-r--r--sapi/tux/php_tux.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c
index 893af5d8db..12d91f0529 100644
--- a/sapi/nsapi/nsapi.c
+++ b/sapi/nsapi/nsapi.c
@@ -638,7 +638,7 @@ static void sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_D
nsapi_free(value);
}
- sprintf(buf, "%d", conf_getglobals()->Vport);
+ snprintf(buf, sizeof(buf), "%d", conf_getglobals()->Vport);
php_register_variable("SERVER_PORT", buf, track_vars_array TSRMLS_CC);
php_register_variable("SERVER_NAME", conf_getglobals()->Vserver_hostname, track_vars_array TSRMLS_CC);
@@ -691,7 +691,7 @@ static void sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_D
/* special variables in error mode */
if (rc->http_error) {
- sprintf(buf, "%d", rc->http_error);
+ snprintf(buf, sizeof(buf), "%d", rc->http_error);
php_register_variable("ERROR_TYPE", buf, track_vars_array TSRMLS_CC);
}
}
diff --git a/sapi/tux/php_tux.c b/sapi/tux/php_tux.c
index 23ca6ab0ec..fd11bd8a42 100644
--- a/sapi/tux/php_tux.c
+++ b/sapi/tux/php_tux.c
@@ -116,7 +116,7 @@ static int sapi_tux_send_headers(sapi_headers_struct *sapi_headers)
status_line = malloc(30);
/* safe sprintf use */
- len = sprintf(status_line, "HTTP/1.1 %d NA\r\n", SG(sapi_headers).http_response_code);
+ len = snprintf(status_line, 30, "HTTP/1.1 %d NA\r\n", SG(sapi_headers).http_response_code);
vec[0].iov_base = status_line;
vec[0].iov_len = len;
@@ -195,7 +195,7 @@ static void sapi_tux_register_variables(zval *track_vars_array TSRMLS_DC)
sapi_header_line ctr = {0};
ctr.line = buf;
- ctr.line_len = sprintf(buf, "Server: %s", TUXAPI_version);
+ ctr.line_len = snprintf(buf, sizeof(buf), "Server: %s", TUXAPI_version);
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array TSRMLS_CC);
@@ -215,7 +215,7 @@ static void sapi_tux_register_variables(zval *track_vars_array TSRMLS_DC)
ADD_STRING("REMOTE_HOST");
}
- sprintf(buf, "%d", CGI_SERVER_PORT(TG(req)));
+ snprintf(buf, sizeof(buf), "%d", CGI_SERVER_PORT(TG(req)));
ADD_STRING("SERVER_PORT");
#if 0
@@ -241,7 +241,7 @@ static void sapi_tux_register_variables(zval *track_vars_array TSRMLS_DC)
#if 0
if (TG(hc)->contentlength != -1) {
- sprintf(buf, "%ld", (long) TG(hc)->contentlength);
+ snprintf(buf, sizeof(buf), "%ld", (long) TG(hc)->contentlength);
ADD_STRING("CONTENT_LENGTH");
}
#endif