Linux bluetooth development
 help / color / mirror / Atom feed
From: sbrown@cortland.com
To: linux-bluetooth@vger.kernel.org
Cc: sbrown@cortland.com
Subject: [PATCH] mesh: meshctl: Correct display security
Date: Fri, 22 Dec 2017 05:29:54 -0500	[thread overview]
Message-ID: <20171222102954.14960-1-sbrown@cortland.com> (raw)

From: Steve Brown <sbrown@cortland.com>

The case of a security command without an argument is not handled
and throws a segv.
---
 mesh/main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/mesh/main.c b/mesh/main.c
index 9360481f8..7e9763a00 100644
--- a/mesh/main.c
+++ b/mesh/main.c
@@ -1670,14 +1670,19 @@ static void cmd_security(int argc, char *argv[])
 	uint8_t level;
 	char *end;
 
+	if (argc == 1)
+		goto done;
+
 	level = strtol(argv[1], &end, 10);
 	if (end == argv[1] || !prov_set_sec_level(level)) {
 		bt_shell_printf("Invalid security level %s\n", argv[1]);
 		return;
 	}
 
-	bt_shell_printf("Provision Security Level set to %u (%s)\n", level,
-						security2str(level));
+done:
+	bt_shell_printf("Provision Security Level set to %u (%s)\n",
+			prov_get_sec_level(),
+			security2str(prov_get_sec_level()));
 }
 
 static void cmd_connect(int argc, char *argv[])
-- 
2.14.1


             reply	other threads:[~2017-12-22 10:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 10:29 sbrown [this message]
2017-12-25 19:06 ` [PATCH] mesh: meshctl: Correct display security Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171222102954.14960-1-sbrown@cortland.com \
    --to=sbrown@cortland.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox