diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2012-10-25 11:12:41 +0100 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2012-10-25 11:12:41 +0100 |
commit | baf50cec89d10055217a3bb210d389694fb1d389 (patch) | |
tree | 98ba96f23f98ceecaf02fbc2e016b297a50c9a25 /image/png.c | |
parent | 0b7db9b47adaf56ae937415040cf585a07eaf8cb (diff) | |
download | netsurf-baf50cec89d10055217a3bb210d389694fb1d389.tar.gz netsurf-baf50cec89d10055217a3bb210d389694fb1d389.tar.bz2 |
make image content handlers title setting use the heap instead of the stack and remove the possibility of buffer overruns
Diffstat (limited to 'image/png.c')
-rw-r--r-- | image/png.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/image/png.c b/image/png.c index 99482d63d..23c755825 100644 --- a/image/png.c +++ b/image/png.c @@ -510,7 +510,7 @@ png_cache_convert_error: static bool nspng_convert(struct content *c) { nspng_content *png_c = (nspng_content *) c; - char title[512]; + char *title; assert(png_c->png != NULL); assert(png_c->info != NULL); @@ -519,11 +519,13 @@ static bool nspng_convert(struct content *c) png_destroy_read_struct(&png_c->png, &png_c->info, 0); /* set title text */ - snprintf(title, sizeof(title), messages_get("PNGTitle"), + title = messages_get_buff("PNGTitle", nsurl_access_leaf(llcache_handle_get_url(c->llcache)), c->width, c->height); - - content__set_title(c, title); + if (title != NULL) { + content__set_title(c, title); + free(title); + } if (png_c->bitmap != NULL) { bitmap_set_opaque(png_c->bitmap, bitmap_test_opaque(png_c->bitmap)); |