1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Forbid octal numbers for width parameter

This commit is contained in:
Joerg Jaspert 2022-06-10 23:42:16 +02:00
parent d1f7f51f99
commit aec63c06fd

View file

@ -570,7 +570,13 @@ impl Config {
let width = match options.value_of(options::WIDTH) {
Some(x) => match x.parse::<u16>() {
Ok(u) => u,
Ok(u) => {
if u != 0 && x.starts_with('0') {
return Err(LsError::InvalidLineWidth(x.into()).into());
} else {
u
}
}
Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()),
},
None => match termsize::get() {