[pbs-devel] [PATCH proxmox-backup v2 06/11] tools/systemd/parse_time: error out on invalid ranges
Dominik Csapak
d.csapak at proxmox.com
Fri Sep 4 14:33:29 CEST 2020
if the range is reverse (bigger..smaller) we will never find a value,
so error out during parsing
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/tools/systemd/parse_time.rs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/tools/systemd/parse_time.rs b/src/tools/systemd/parse_time.rs
index 93657b21..051c4968 100644
--- a/src/tools/systemd/parse_time.rs
+++ b/src/tools/systemd/parse_time.rs
@@ -145,6 +145,9 @@ fn parse_date_time_comp(max: usize) -> impl Fn(&str) -> IResult<&str, DateTimeVa
let (i, value) = parse_time_comp(max)(i)?;
if let (i, Some(end)) = opt(preceded(tag(".."), parse_time_comp(max)))(i)? {
+ if value > end {
+ return Err(parse_error(i, "range start is bigger than end"));
+ }
return Ok((i, DateTimeValue::Range(value, end)))
}
--
2.20.1
More information about the pbs-devel
mailing list