mirror of
https://github.com/uutils/coreutils
synced 2024-12-15 15:52:42 +00:00
echo: check argument length when parsing options
This commit is contained in:
parent
b3f83378b7
commit
fc7f291a68
1 changed files with 1 additions and 1 deletions
|
@ -96,7 +96,7 @@ fn parse_options(args: Vec<String>, options: &mut EchoOptions) -> Option<Vec<Str
|
|||
"-e" => options.escape = true,
|
||||
"-E" => options.escape = false,
|
||||
_ => {
|
||||
if arg.as_slice().char_at(0) == '-' && arg.len() > 1 {
|
||||
if arg.len() > 1 && arg.as_slice().char_at(0) == '-' {
|
||||
let mut newopts = options.clone();
|
||||
let argptr: *String = &arg; // escape from the borrow checker
|
||||
for ch in unsafe { (*argptr).as_slice() }.chars().skip(1) {
|
||||
|
|
Loading…
Reference in a new issue