Linux bluetooth development
 help / color / mirror / Atom feed
From: Jerzy Kasenberg <jerzy.kasenberg@tieto.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Jerzy Kasenberg <jerzy.kasenberg@tieto.com>
Subject: [PATCH v2] android/client: Fix crash in tab completion
Date: Wed, 30 Oct 2013 10:31:12 +0100	[thread overview]
Message-ID: <1383125472-6813-1-git-send-email-jerzy.kasenberg@tieto.com> (raw)

When user pressed tab on third or later argument when
first two did not make sense tool crashed.
Now method is checked for NULL before accessing help field.
---
First version was doing to much (crash was gone but so was
completion when completion function was not provided, just help
string)

 android/client/tabcompletion.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/client/tabcompletion.c b/android/client/tabcompletion.c
index 69af609..cc1a5d3 100644
--- a/android/client/tabcompletion.c
+++ b/android/client/tabcompletion.c
@@ -332,7 +332,7 @@ static void param_completion(int argc, const split_arg_t *arg,
 	if (args.func != NULL) {
 		args.typed = argv[argc - 1];
 		args.help = method_help;
-		args.user_help = (void *) method->help;
+		args.user_help = method ? (void *) method->help : NULL;
 
 		tab_completion(&args);
 	}
-- 
1.7.9.5


             reply	other threads:[~2013-10-30  9:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30  9:31 Jerzy Kasenberg [this message]
2013-10-30 10:07 ` [PATCH v2] android/client: Fix crash in tab completion 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=1383125472-6813-1-git-send-email-jerzy.kasenberg@tieto.com \
    --to=jerzy.kasenberg@tieto.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