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/jpeg.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/jpeg.c')
-rw-r--r-- | image/jpeg.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/image/jpeg.c b/image/jpeg.c index 7c68fb668..fd18238f7 100644 --- a/image/jpeg.c +++ b/image/jpeg.c @@ -289,7 +289,7 @@ static bool nsjpeg_convert(struct content *c) union content_msg_data msg_data; const char *data; unsigned long size; - char title[512]; + char *title; /* check image header is valid and get width/height */ data = content__get_source_data(c, &size); @@ -325,10 +325,14 @@ static bool nsjpeg_convert(struct content *c) image_cache_add(c, NULL, jpeg_cache_convert); - snprintf(title, sizeof(title), messages_get("JPEGTitle"), + /* set title text */ + title = messages_get_buff("JPEGTitle", 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); + } content_set_ready(c); content_set_done(c); |