Fix buffer overrun in MinidumpModule::debug_identifier with MDCVInfoELF

This commit is contained in:
Ted Mielczarek 2016-02-17 06:20:58 -05:00
parent 358c3b449c
commit 7b25f70813

View file

@ -47,6 +47,7 @@
#include <unistd.h>
#endif // _WIN32
#include <algorithm>
#include <fstream>
#include <iostream>
#include <limits>
@ -2054,7 +2055,8 @@ string MinidumpModule::debug_identifier() const {
// The full build id is available by calling code_identifier.
MDGUID guid = {0};
memcpy(&guid, &cv_record_elf->build_id,
cv_record_->size() - MDCVInfoELF_minsize);
std::min(cv_record_->size() - MDCVInfoELF_minsize,
sizeof(MDGUID)));
identifier = guid_and_age_to_debug_id(guid, 0);
}
}