Fixed possible out of bound array access.
The check of index value moved to before the write to the array. Differential Revision: https://reviews.llvm.org/D60471 llvm-svn: 358181
This commit is contained in:
parent
d843da6218
commit
705384be97
|
@ -4462,10 +4462,10 @@ static void __kmp_stg_parse_hw_subset(char const *name, char const *value,
|
|||
pos = input;
|
||||
components[level++] = pos;
|
||||
while ((pos = strchr(pos, ','))) {
|
||||
if (level >= MAX_T_LEVEL)
|
||||
goto err; // too many components provided
|
||||
*pos = '\0'; // modify input and avoid more copying
|
||||
components[level++] = ++pos; // expect something after ","
|
||||
if (level > MAX_T_LEVEL)
|
||||
goto err; // too many components provided
|
||||
}
|
||||
// Check each component
|
||||
for (int i = 0; i < level; ++i) {
|
||||
|
|
Loading…
Reference in New Issue