Avoid use of variable-length arrays when not necessary

Change-Id: I45872ed02bbcf49b2709276dbb38cf72fab5cb1c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2259335
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Eric Astor 2020-06-23 10:02:16 -04:00
parent ca0fd934d9
commit d9c3e7cb36

View File

@ -88,8 +88,9 @@ bool ReadMemoryRangeWhitelist(
return false;
}
SanitizationMemoryRangeWhitelist::Range ranges[list.size];
if (!memory.Read(list.entries, sizeof(ranges), &ranges)) {
std::vector<SanitizationMemoryRangeWhitelist::Range> ranges(list.size);
if (!memory.Read(list.entries, sizeof(ranges[0]) * list.size,
ranges.data())) {
LOG(ERROR) << "Failed to read memory range whitelist entries.";
return false;
}