diff options
| author | Heinrich Schuchardt <[email protected]> | 2022-12-31 00:49:10 +0100 |
|---|---|---|
| committer | Heinrich Schuchardt <[email protected]> | 2023-01-04 13:17:42 +0100 |
| commit | 532952f63cfa708a04aba837f68ffe321489cdef (patch) | |
| tree | 7dda1011fe4e648d4353ead50321dbf41ac11340 /cmd | |
| parent | 582e3c9fb2337c2f49faa73ac86dde25f4d56901 (diff) | |
cmd: avoid endless loop in sound play command
A parameter starting with a hyphen leads to an endless loop in the sound
play command.
Leave it to dectoul() to handle the hyphen. It will return 0 for a negative
number.
Signed-off-by: Heinrich Schuchardt <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/sound.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/sound.c b/cmd/sound.c index cef71be5e34..0b7f9599716 100644 --- a/cmd/sound.c +++ b/cmd/sound.c @@ -48,12 +48,12 @@ static int do_play(struct cmd_tbl *cmdtp, int flag, int argc, ++argv; while (argc || first) { first = false; - if (argc && *argv[0] != '-') { + if (argc) { msec = dectoul(argv[0], NULL); --argc; ++argv; } - if (argc && *argv[0] != '-') { + if (argc) { freq = dectoul(argv[0], NULL); --argc; ++argv; |
