summaryrefslogtreecommitdiff
path: root/image/webp.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2012-10-25 11:12:41 +0100
committerVincent Sanders <vince@netsurf-browser.org>2012-10-25 11:12:41 +0100
commitbaf50cec89d10055217a3bb210d389694fb1d389 (patch)
tree98ba96f23f98ceecaf02fbc2e016b297a50c9a25 /image/webp.c
parent0b7db9b47adaf56ae937415040cf585a07eaf8cb (diff)
downloadnetsurf-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/webp.c')
-rw-r--r--image/webp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/image/webp.c b/image/webp.c
index acf226b5f..fc4356c01 100644
--- a/image/webp.c
+++ b/image/webp.c
@@ -78,7 +78,7 @@ static bool webp_convert(struct content *c)
unsigned char *imagebuf = NULL;
unsigned long size;
int width = 0, height = 0;
- char title[512];
+ char *title;
int res = 0;
uint8_t *res_p = NULL;
@@ -116,10 +116,15 @@ static bool webp_convert(struct content *c)
c->width = width;
c->height = height;
- snprintf(title, sizeof(title), messages_get("WebPTitle"),
+
+ /* set title */
+ title = messages_get_buff("WebPTitle",
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);
+ }
bitmap_modified(webp->bitmap);