Fix global overflow in types::lookupTypeForTypeSpecifier.
memcpy() is allowed to read entire contents of both memory areas. Found with AddressSanitizer. llvm-svn: 176237
This commit is contained in:
parent
1052c99f46
commit
00eef441ff
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue