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:
parent
8b59119e10
commit
13b02a724f
Notes:
blender-bot
2023-02-13 22:19:24 +01:00
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue