1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-28 01:28:30 +00:00

Fix more sonar issues.

This commit is contained in:
Brenden Matthews 2018-12-23 15:12:38 -05:00
parent 3df87776d5
commit d422aa47d2
2 changed files with 9 additions and 3 deletions

View File

@ -1014,7 +1014,7 @@ int update_stat(void) {
cpu[idx].cpu_last_total = cpu[idx].cpu_total;
cpu[idx].cpu_last_active_total = cpu[idx].cpu_active_total;
for (i = samples - 1; i > 0; i--) {
for (i = samples - 1; i > 0 && i < CPU_SAMPLE_COUNT; i--) {
cpu[idx].cpu_val[i] = cpu[idx].cpu_val[i - 1];
}
}

View File

@ -814,7 +814,10 @@ void imap_cb::work() {
}
if (buf != nullptr) {
// back up until we reach '*'
while (buf >= recvbuf && buf[0] != '*') { buf--; }
while (buf >= recvbuf && buf < (recvbuf + MAXDATASIZE) - 1 &&
buf[0] != '*') {
buf--;
}
if (sscanf(buf, "* %lu EXISTS\r\n", &messages) == 1) {
std::lock_guard<std::mutex> lock(result_mutex);
if (result.messages != messages) {
@ -831,7 +834,10 @@ void imap_cb::work() {
}
if (buf != nullptr) {
// back up until we reach '*'
while (buf >= recvbuf && buf[0] != '*') { buf--; }
while (buf >= recvbuf && buf < (recvbuf + MAXDATASIZE) - 1 &&
buf[0] != '*') {
buf--;
}
if (sscanf(buf, "* %lu RECENT\r\n", &recent) != 1) { recent = 0; }
}
}