diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-04 14:19:00 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-04 14:19:00 +0100 |
commit | 683164999675314cb35353df413decbcd5489b45 (patch) | |
tree | e509ce9aa692bc6c5abbb5d3916e31d132243cf2 /src/libmime | |
parent | 3148ef9183936dd374ae934cb53eced969ff7766 (diff) | |
download | rspamd-683164999675314cb35353df413decbcd5489b45.tar.gz rspamd-683164999675314cb35353df413decbcd5489b45.zip |
[Feature] Support EXIF jpeg images
Diffstat (limited to 'src/libmime')
-rw-r--r-- | src/libmime/images.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libmime/images.c b/src/libmime/images.c index ff44ab489..bcb299f9c 100644 --- a/src/libmime/images.c +++ b/src/libmime/images.c @@ -21,7 +21,8 @@ static const guint8 png_signature[] = {137, 80, 78, 71, 13, 10, 26, 10}; static const guint8 jpg_sig1[] = {0xff, 0xd8}; -static const guint8 jpg_sig2[] = {'J', 'F', 'I', 'F'}; +static const guint8 jpg_sig_jfif[] = {0xff, 0xe0}; +static const guint8 jpg_sig_exif[] = {0xff, 0xe1}; static const guint8 gif_signature[] = {'G', 'I', 'F', '8'}; static const guint8 bmp_signature[] = {'B', 'M'}; @@ -54,7 +55,8 @@ detect_image_type (GByteArray *data) } if (data->len > 10) { if (memcmp (data->data, jpg_sig1, sizeof (jpg_sig1)) == 0) { - if (memcmp (data->data + 6, jpg_sig2, sizeof (jpg_sig2)) == 0) { + if (memcmp (data->data + 2, jpg_sig_jfif, sizeof (jpg_sig_jfif)) == 0 || + memcmp (data->data + 2, jpg_sig_exif, sizeof (jpg_sig_exif)) == 0) { return IMAGE_TYPE_JPG; } } |