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.
This commit is contained in:
Campbell Barton
2020-11-11 14:08:53 +11:00
parent 8953485f56
commit 12168ccf18

View File

@@ -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;