mirror of https://github.com/polybar/polybar.git
fix(memory): Safety check
This commit is contained in:
parent
2cde3f31a0
commit
9184a8b046
|
@ -47,8 +47,10 @@ namespace modules {
|
|||
|
||||
while (std::getline(in, str) && i++ < 3) {
|
||||
size_t off = str.find_first_of("1234567890", str.find(':'));
|
||||
if (off != string::npos && str.size() > off) {
|
||||
buffer << std::strtol(&str[off], nullptr, 10) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
buffer >> rdbuf;
|
||||
kb_total = std::atol(rdbuf.c_str());
|
||||
|
|
Loading…
Reference in New Issue