mirror of
https://github.com/uutils/coreutils
synced 2025-01-18 16:14:13 +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 = true,
|
||||||
"-E" => options.escape = false,
|
"-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 mut newopts = options.clone();
|
||||||
let argptr: *String = &arg; // escape from the borrow checker
|
let argptr: *String = &arg; // escape from the borrow checker
|
||||||
for ch in unsafe { (*argptr).as_slice() }.chars().skip(1) {
|
for ch in unsafe { (*argptr).as_slice() }.chars().skip(1) {
|
||||||
|
|
Loading…
Reference in a new issue