From af7d0c64a88a59c237db90528f86af4b375ed341 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Mon, 13 Feb 2017 20:38:13 +0100 Subject: [PATCH] Bluetooth: shell: Fix accessing invalid memory argc needs to be check before accessing argv. Change-Id: I9cb70906a388b96df4e192dd4f31eafdab25127f Signed-off-by: Szymon Janc --- tests/bluetooth/shell/src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/bluetooth/shell/src/main.c b/tests/bluetooth/shell/src/main.c index f207f8c1f0b..83bf1cde432 100644 --- a/tests/bluetooth/shell/src/main.c +++ b/tests/bluetooth/shell/src/main.c @@ -1404,6 +1404,10 @@ static bool hrs_simulate; static int cmd_hrs_simulate(int argc, char *argv[]) { + if (argc < 2) { + return -EINVAL; + } + if (!strcmp(argv[1], "on")) { static bool hrs_registered;