From 7d2665843fd7f8d83bcee7e3ada22eea86de11e4 Mon Sep 17 00:00:00 2001 From: Jan Kneschke Date: Fri, 17 Aug 2007 23:35:26 +0000 Subject: [PATCH] fixed counter overrun in ?auto in mod_status (#909) git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1941 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/mod_status.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 3b4159ff..bb5f4b36 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ NEWS * fixed invalid char in header values (#1286) * fixed invalid "304 Not Modified" on broken timestamps * fixed endless loop on shrinked files with sendfile() on BSD (#1289) + * fixed counter overrun in ?auto in mod_status (#909) * removed config-check if passwd files exist (#1188) - 1.4.16 - diff --git a/src/mod_status.c b/src/mod_status.c index e64cb29b..80c00401 100644 --- a/src/mod_status.c +++ b/src/mod_status.c @@ -559,19 +559,22 @@ static handler_t mod_status_handle_server_status_text(server *srv, connection *c buffer *b; double avg; time_t ts; + char buf[32]; b = chunkqueue_get_append_buffer(con->write_queue); /* output total number of requests */ BUFFER_APPEND_STRING_CONST(b, "Total Accesses: "); avg = p->abs_requests; - buffer_append_long(b, avg); + snprintf(buf, sizeof(buf) - 1, "%.0f", avg); + buffer_append_string(b, buf); BUFFER_APPEND_STRING_CONST(b, "\n"); /* output total traffic out in kbytes */ BUFFER_APPEND_STRING_CONST(b, "Total kBytes: "); avg = p->abs_traffic_out / 1024; - buffer_append_long(b, avg); + snprintf(buf, sizeof(buf) - 1, "%.0f", avg); + buffer_append_string(b, buf); BUFFER_APPEND_STRING_CONST(b, "\n"); /* output uptime */