* [pbs-devel] [PATCH proxmox-backup] fix #3017: check array boundaries before using
@ 2020-09-21 7:12 Dominik Csapak
2020-09-21 7:21 ` [pbs-devel] applied: " Dietmar Maurer
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2020-09-21 7:12 UTC (permalink / raw)
To: pbs-devel
else we panic here
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/server/worker_task.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/server/worker_task.rs b/src/server/worker_task.rs
index 0f7e291a..771e8447 100644
--- a/src/server/worker_task.rs
+++ b/src/server/worker_task.rs
@@ -210,7 +210,7 @@ pub fn upid_read_status(upid: &UPID) -> Result<TaskState, Error> {
file.read_to_end(&mut data)?;
// task logs should end with newline, we do not want it here
- if data[data.len()-1] == b'\n' {
+ if data.len() > 0 && data[data.len()-1] == b'\n' {
data.pop();
}
@@ -218,7 +218,7 @@ pub fn upid_read_status(upid: &UPID) -> Result<TaskState, Error> {
let mut start = 0;
for pos in (0..data.len()).rev() {
if data[pos] == b'\n' {
- start = pos + 1;
+ start = data.len().min(pos + 1);
break;
}
}
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-21 7:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 7:12 [pbs-devel] [PATCH proxmox-backup] fix #3017: check array boundaries before using Dominik Csapak
2020-09-21 7:21 ` [pbs-devel] applied: " Dietmar Maurer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox