diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-12-10 15:32:42 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-12-18 15:15:29 +0000 |
commit | c2ed8618e489ee79ff9073e601f44c71d0ad987e (patch) | |
tree | 6efe53858eff29993fe59b81e1f2ff15b16f644e /external | |
parent | epee: trap failure to parse URI from request (diff) | |
download | monero-c2ed8618e489ee79ff9073e601f44c71d0ad987e.tar.xz |
easylogging++: avoid buffer underflow
Diffstat (limited to 'external')
-rw-r--r-- | external/easylogging++/easylogging++.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/external/easylogging++/easylogging++.cc b/external/easylogging++/easylogging++.cc index 31b201897..57742b2e5 100644 --- a/external/easylogging++/easylogging++.cc +++ b/external/easylogging++/easylogging++.cc @@ -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); } |