diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-02-28 07:53:32 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-02-28 07:53:32 +0000 |
commit | 16cda861c5587d7130a216466a29a808673c1656 (patch) | |
tree | 4c0b20a4e68afc862b55784d417c84fdddf928a2 /lib/Driver/Types.cpp | |
parent | e33d852452c7008ccd0677aae88f1055cf1a9af1 (diff) | |
download | clang-16cda861c5587d7130a216466a29a808673c1656.tar.gz |
Fix global overflow in types::lookupTypeForTypeSpecifier.
memcpy() is allowed to read entire contents of both memory areas.
Found with AddressSanitizer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176237 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Types.cpp')
-rw-r--r-- | lib/Driver/Types.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/Driver/Types.cpp b/lib/Driver/Types.cpp index cab6dcc327..88574fc2c3 100644 --- a/lib/Driver/Types.cpp +++ b/lib/Driver/Types.cpp @@ -168,12 +168,10 @@ types::ID types::lookupTypeForExtension(const char *Ext) { } types::ID types::lookupTypeForTypeSpecifier(const char *Name) { - unsigned N = strlen(Name); - for (unsigned i=0; i<numTypes; ++i) { types::ID Id = (types::ID) (i + 1); if (canTypeBeUserSpecified(Id) && - memcmp(Name, getInfo(Id).Name, N + 1) == 0) + strcmp(Name, getInfo(Id).Name) == 0) return Id; } |