Skip to content

Commit 532952f

Browse files
committed
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]>
1 parent 582e3c9 commit 532952f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/sound.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ static int do_play(struct cmd_tbl *cmdtp, int flag, int argc,
4848
++argv;
4949
while (argc || first) {
5050
first = false;
51-
if (argc && *argv[0] != '-') {
51+
if (argc) {
5252
msec = dectoul(argv[0], NULL);
5353
--argc;
5454
++argv;
5555
}
56-
if (argc && *argv[0] != '-') {
56+
if (argc) {
5757
freq = dectoul(argv[0], NULL);
5858
--argc;
5959
++argv;

0 commit comments

Comments
 (0)