Skip to content

Commit 4451cee

Browse files
Thalleykartben
authored andcommitted
Bluetooth: ISO: Shell: Fix underflow of count for TX
The cmd_broadcast and cmd_send both should not take a count value less than 1. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
1 parent 759e31d commit 4451cee

File tree

1 file changed

+13
-0
lines changed
  • subsys/bluetooth/host/shell

1 file changed

+13
-0
lines changed

subsys/bluetooth/host/shell/iso.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* SPDX-License-Identifier: Apache-2.0
1111
*/
1212

13+
#include <stddef.h>
1314
#include <stdlib.h>
1415
#include <ctype.h>
1516
#include <zephyr/kernel.h>
@@ -557,6 +558,12 @@ static int cmd_send(const struct shell *sh, size_t argc, char *argv[])
557558

558559
return -ENOEXEC;
559560
}
561+
562+
if (count < 1) {
563+
shell_error(sh, "Cannot send 0 times");
564+
565+
return -ENOEXEC;
566+
}
560567
}
561568

562569
if (!iso_chan.iso) {
@@ -673,6 +680,12 @@ static int cmd_broadcast(const struct shell *sh, size_t argc, char *argv[])
673680

674681
return -ENOEXEC;
675682
}
683+
684+
if (count < 1) {
685+
shell_error(sh, "Cannot send 0 times");
686+
687+
return -ENOEXEC;
688+
}
676689
}
677690

678691
if (!bis_iso_chan.iso) {

0 commit comments

Comments
 (0)