From eb9c223f9d61f700ec27cb10b1aa892cd8a2d766 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 12 Oct 2011 12:34:11 +0000 Subject: fix image cache summary information to properly use a format string remove snprintf buffer overflow possibility fix the about:imagecache fetcher to contain the output formatting and use summary information formatting svn path=/trunk/netsurf/; revision=13039 --- content/fetchers/about.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'content/fetchers') diff --git a/content/fetchers/about.c b/content/fetchers/about.c index 21e97a045..7ffe52db2 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -198,7 +198,21 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) goto fetch_about_imagecache_handler_aborted; /* image cache summary */ - slen = image_cache_snsummaryf(buffer, sizeof(buffer), NULL); + slen = image_cache_snsummaryf(buffer, sizeof(buffer), + "

Configured limit of %a hysteresis of %b" + "

Total bitmap size in use %c (in %d)" + "

Age %es" + "

Peak size %f (in %g)" + "

Peak image count %h (size %i)" + "

Cache total/hit/miss/fail (counts) %j/%k/%l/%m " + "(%pj%%/%pk%%/%pl%%/%pm%%)" + "

Cache total/hit/miss/fail (size) %n/%o/%q/%r " + "(%pn%%/%po%%/%pq%%/%pr%%)" + "

Total images never rendered: %s " + "(includes %t that were converted)" + "

Total number of excessive conversions: %u " + "(from %v images converted more than once)" + "

Bitmap of size %w had most (%x) conversions"); if (slen >= (int) (sizeof(buffer))) goto fetch_about_imagecache_handler_aborted; /* overflow */ @@ -210,7 +224,13 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) /* image cache entry table */ slen = snprintf(buffer, sizeof buffer, "\n" - "\n"); + "" + "" + "" + "" + "" + "" + "\n"); do { res = image_cache_snentryf(buffer + slen, sizeof buffer - slen, cent_loop, -- cgit v1.2.3
EntryContent KeyRedraw CountConversion CountLast RedrawBitmap AgeBitmap Size
EntryContent KeyRedraw CountConversion CountLast RedrawBitmap AgeBitmap Size