pino added inline comments. INLINE COMMENTS
> kra.cpp:22 > +static constexpr char s_magic[] = "application/x-krita"; > +static constexpr int s_magic_size = sizeof(s_magic); > + this also counts the null terminator (as it is part of the static string) > kra.cpp:61 > if (device->peek(buff, sizeof(buff)) == sizeof(buff)) > - return qstrcmp(buff + 0x26, "application/x-krita") == 0; > + return qstrncmp(buff + 0x26, s_magic, s_magic_size) == 0; > this can be memcmp even (slightly faster than str*cmp) > ora.cpp:21 > +static constexpr char s_magic[] = "image/openraster"; > +static constexpr int s_magic_size = sizeof(s_magic); > + ditto > ora.cpp:60 > if (device->peek(buff, sizeof(buff)) == sizeof(buff)) > - return qstrcmp(buff + 0x26, "image/openraster") == 0; > + return qstrncmp(buff + 0x26, s_magic, s_magic_size) == 0; > ditto REPOSITORY R287 KImageFormats REVISION DETAIL https://phabricator.kde.org/D20143 To: aacid Cc: pino, security-team, rempt, kde-frameworks-devel, michaelh, ngraham, bruns