diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-11-11 06:08:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-11-11 06:41:04 +0300 |
commit | 12168ccf189df580b3a2ffd95bcc31a51c7d86a3 (patch) | |
tree | cc0895a669ecf876531324c215c1cc08268326f3 /source/blender | |
parent | 8953485f5612f6ddf1ce7be2320b349383caefdd (diff) |
ImBuf: replace incorrect strstr use with memcmp
Besides being incorrect as only the first two bytes should be tested,
searching binary data using `strstr` can easily read past buffer bounds.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/imbuf/intern/radiance_hdr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 3dd26e1f7a2..21709fa8603 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -203,7 +203,7 @@ int imb_is_a_hdr(const unsigned char *buf) /* update: actually, the 'RADIANCE' part is just an optional program name, * the magic word is really only the '#?' part */ // if (strstr((char *)buf, "#?RADIANCE")) return 1; - if (strstr((char *)buf, "#?")) { + if (memcmp((char *)buf, "#?", 2) == 0) { return 1; } // if (strstr((char *)buf, "32-bit_rle_rgbe")) return 1; |