[mod_status] use snprintf() instead of sprintf()

From: Glenn Strauss <gstrauss@gluelogic.com>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3134 152afb58-edef-0310-8abb-c4023f1b3aa9
This commit is contained in:
Glenn Strauss 2016-04-01 16:54:43 +00:00 committed by Stefan Bühler
parent ab829cee5e
commit dac02e257c
2 changed files with 4 additions and 3 deletions

1
NEWS
View File

@ -57,6 +57,7 @@ NEWS
* [core] lighttpd -tt performs preflight startup checks (fixes #411)
* [stat] mimetype.xattr-name global config option (fixes #2631)
* [mod_webdav] allow Depth: Infinity lock on file (fixes #2296)
* [mod_status] use snprintf() instead of sprintf()
- 1.4.39 - 2016-01-02
* [core] fix memset_s call (fixes #2698)

View File

@ -368,7 +368,7 @@ static handler_t mod_status_handle_server_status_html(server *srv, connection *c
mod_status_get_multiplier(&avg, &multiplier, 1024);
sprintf(buf, "%.2f", avg);
snprintf(buf, sizeof(buf), "%.2f", avg);
buffer_append_string(b, buf);
buffer_append_string_len(b, CONST_STR_LEN(" "));
if (multiplier) buffer_append_string_len(b, &multiplier, 1);
@ -393,7 +393,7 @@ static handler_t mod_status_handle_server_status_html(server *srv, connection *c
mod_status_get_multiplier(&avg, &multiplier, 1024);
sprintf(buf, "%.2f", avg);
snprintf(buf, sizeof(buf), "%.2f", avg);
buffer_append_string(b, buf);
buffer_append_string_len(b, CONST_STR_LEN(" "));
if (multiplier) buffer_append_string_len(b, &multiplier, 1);
@ -428,7 +428,7 @@ static handler_t mod_status_handle_server_status_html(server *srv, connection *c
mod_status_get_multiplier(&avg, &multiplier, 1024);
sprintf(buf, "%.2f", avg);
snprintf(buf, sizeof(buf), "%.2f", avg);
buffer_append_string(b, buf);
buffer_append_string_len(b, CONST_STR_LEN(" "));
if (multiplier) buffer_append_string_len(b, &multiplier, 1);