about:imagecache gives URL links, and table is styled. This has revealed a buffer overflow or similar here; reducing the buffer size to 1024 makes it very fragile with long URLs.

svn path=/trunk/netsurf/; revision=13700
This commit is contained in:
Rob Kendrick 2012-03-25 16:42:45 +00:00
parent 903f456547
commit e6155dd37f
3 changed files with 27 additions and 4 deletions

View File

@ -174,3 +174,20 @@ body#configlist table.config td + td {
body#configlist .null-content {
font-style: italic; }
/* about:imagecache */
table.imagecachelist {
border: 1px solid #000;
border-spacing: 0px;
border-collapse: collapse;
}
table.imagecachelist th {
border: 1px solid #000;
}
table.imagecachelist td {
border: 1px solid #000;
}

View File

@ -181,7 +181,7 @@ static bool fetch_about_licence_handler(struct fetch_about_context *ctx)
static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
{
fetch_msg msg;
char buffer[1024]; /* output buffer */
char buffer[2048]; /* output buffer */
int code = 200;
int slen;
unsigned int cent_loop = 0;
@ -240,18 +240,19 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
/* image cache entry table */
slen = snprintf(buffer, sizeof buffer,
"<table class=\"config\">\n"
"<table class=\"imagecachelist\">\n"
"<tr><th>Entry</th>"
"<th>Content Key</th>"
"<th>Redraw Count</th>"
"<th>Conversion Count</th>"
"<th>Last Redraw</th>"
"<th>Bitmap Age</th>"
"<th>Bitmap Size</th></tr>\n");
"<th>Bitmap Size</th>"
"<th>Source URL</th></tr>\n");
do {
res = image_cache_snentryf(buffer + slen, sizeof buffer - slen,
cent_loop,
"<tr><td>%e</td><td>%k</td><td>%r</td><td>%c</td><td>%a</td><td>%g</td><td>%s</td></tr>\n");
"<tr><td>%e</td><td>%k</td><td>%r</td><td>%c</td><td>%a</td><td>%g</td><td>%s</td><td><a href='%U'>%U</a></td></tr>\n");
if (res <= 0)
break; /* last option */

View File

@ -677,6 +677,11 @@ int image_cache_snentryf(char *string, size_t size, unsigned int entryn,
"%p", centry->content);
break;
case 'U':
slen += snprintf(string + slen, size - slen,
"%s", nsurl_access(llcache_handle_get_url(centry->content->llcache)));
break;
case 's':
if (centry->bitmap != NULL) {
slen += snprintf(string + slen,