fix(memory): Safety check

This commit is contained in:
Michael Carlberg 2017-01-12 20:25:57 +01:00
parent 2cde3f31a0
commit 9184a8b046
1 changed files with 3 additions and 1 deletions

View File

@ -47,7 +47,9 @@ namespace modules {
while (std::getline(in, str) && i++ < 3) { while (std::getline(in, str) && i++ < 3) {
size_t off = str.find_first_of("1234567890", str.find(':')); size_t off = str.find_first_of("1234567890", str.find(':'));
buffer << std::strtol(&str[off], nullptr, 10) << std::endl; if (off != string::npos && str.size() > off) {
buffer << std::strtol(&str[off], nullptr, 10) << std::endl;
}
} }
buffer >> rdbuf; buffer >> rdbuf;