summaryrefslogtreecommitdiff
path: root/lib/Support/Path.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-10-16 03:29:49 +0000
committerRui Ueyama <ruiu@google.com>2013-10-16 03:29:49 +0000
commit86df596c4121633114fca22585583f7b585b87aa (patch)
tree88b4405e90019a10e46924d03013a0b68abd2cf5 /lib/Support/Path.cpp
parenta2ef865fa9e2d2fa108f9d3c1d3a63c1607bf1d4 (diff)
downloadllvm-86df596c4121633114fca22585583f7b585b87aa.tar.gz
llvm-86df596c4121633114fca22585583f7b585b87aa.tar.bz2
llvm-86df596c4121633114fca22585583f7b585b87aa.tar.xz
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
Diffstat (limited to 'lib/Support/Path.cpp')
-rw-r--r--lib/Support/Path.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp
index 390614b9a5..7fc9ab8967 100644
--- a/lib/Support/Path.cpp
+++ b/lib/Support/Path.cpp
@@ -849,7 +849,7 @@ error_code has_magic(const Twine &path, const Twine &magic, bool &result) {
switch ((unsigned char)Magic[0]) {
case 0x00: {
// 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) &&
memcmp(Magic.data(), Expected, sizeof(Expected)) == 0)
return file_magic::windows_resource;