зеркало из https://github.com/microsoft/clang-1.git
Fix invalid reads by memcmp.
Str may be smaller than Start->Name here. Use strncmp to avoid scanning past the end. Found by valgrind. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165157 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
ddc57332cd
Коммит
2df1bd4431
|
@ -162,7 +162,7 @@ Arg *OptTable::ParseOneArg(const ArgList &Args, unsigned &Index) const {
|
|||
for (; Start != End; ++Start) {
|
||||
// Scan for first option which is a proper prefix.
|
||||
for (; Start != End; ++Start)
|
||||
if (memcmp(Str, Start->Name, strlen(Start->Name)) == 0)
|
||||
if (strncmp(Str, Start->Name, strlen(Start->Name)) == 0)
|
||||
break;
|
||||
if (Start == End)
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче