Mon, 22 Oct 2018 18:37:33 -0500
facebook: Limit received images to 10MiB
This patch limits the recently unlimited received image size to 10MiB
for the Facebook protocol plugin.
| libpurple/protocols/facebook/data.c | file | annotate | diff | comparison | revisions | |
| libpurple/protocols/facebook/data.h | file | annotate | diff | comparison | revisions |
--- a/libpurple/protocols/facebook/data.c Mon Oct 22 18:35:36 2018 -0500 +++ b/libpurple/protocols/facebook/data.c Mon Oct 22 18:37:33 2018 -0500 @@ -602,7 +602,7 @@ url = fb_data_image_get_url(img); req = purple_http_request_new(url); - purple_http_request_set_max_len(req, -1); + purple_http_request_set_max_len(req, FB_DATA_ICON_SIZE_MAX); con = purple_http_request(priv->gc, req, fb_data_image_cb, img); fb_http_conns_add(priv->cons, con);
--- a/libpurple/protocols/facebook/data.h Mon Oct 22 18:35:36 2018 -0500 +++ b/libpurple/protocols/facebook/data.h Mon Oct 22 18:37:33 2018 -0500 @@ -61,6 +61,13 @@ */ #define FB_DATA_ICON_MAX 4 +/** + * FB_DATA_ICON_SIZE_MAX: + * + * The maximum size of a fetched icon. + */ +#define FB_DATA_ICON_SIZE_MAX 0xa00000 /* 10MiB */ + typedef struct _FbData FbData; typedef struct _FbDataClass FbDataClass; typedef struct _FbDataPrivate FbDataPrivate;