mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
Fix a bug in Windows resource file detection.
The magic bytes should not include the trailing NUL byte. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192769 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a2ef865fa9
commit
86df596c41
@ -849,7 +849,7 @@ error_code has_magic(const Twine &path, const Twine &magic, bool &result) {
|
|||||||
switch ((unsigned char)Magic[0]) {
|
switch ((unsigned char)Magic[0]) {
|
||||||
case 0x00: {
|
case 0x00: {
|
||||||
// Windows resource file
|
// Windows resource file
|
||||||
const char Expected[] = "\0\0\0\0\x20\0\0\0\xff";
|
const char Expected[] = { 0, 0, 0, 0, '\x20', 0, 0, 0, '\xff' };
|
||||||
if (Magic.size() >= sizeof(Expected) &&
|
if (Magic.size() >= sizeof(Expected) &&
|
||||||
memcmp(Magic.data(), Expected, sizeof(Expected)) == 0)
|
memcmp(Magic.data(), Expected, sizeof(Expected)) == 0)
|
||||||
return file_magic::windows_resource;
|
return file_magic::windows_resource;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user