mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-30 03:03:17 +00:00
easylogging++: avoid buffer underflow
This commit is contained in:
parent
187a6ab2d2
commit
c2ed8618e4
1 changed files with 3 additions and 2 deletions
5
external/easylogging++/easylogging++.cc
vendored
5
external/easylogging++/easylogging++.cc
vendored
|
@ -1016,8 +1016,9 @@ const std::string OS::getBashOutput(const char* command) {
|
|||
char hBuff[4096];
|
||||
if (fgets(hBuff, sizeof(hBuff), proc) != nullptr) {
|
||||
pclose(proc);
|
||||
if (hBuff[strlen(hBuff) - 1] == '\n') {
|
||||
hBuff[strlen(hBuff) - 1] = '\0';
|
||||
const size_t len = strlen(hBuff);
|
||||
if (len > 0 && hBuff[len - 1] == '\n') {
|
||||
hBuff[len- 1] = '\0';
|
||||
}
|
||||
return std::string(hBuff);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue