2013-07-19 04:31:52

by Sathish Narasimman

[permalink] [raw]
Subject: [PATCH BlueZ] attrib: Fix interactive gatttool segfault

passing the special character single quote

$gatttool -I
[ ][ ][LE]> '
Segmentation fault (core dumped)

Checking g_shell_parse_argv fail status(return FALSE on failure), works fine.

hope the fix to the previous "git am" error is solved

---
attrib/interactive.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/attrib/interactive.c b/attrib/interactive.c
index f28dc22..4fd7276 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -867,7 +867,8 @@ static void parse_line(char *line_read)

add_history(line_read);

- g_shell_parse_argv(line_read, &argcp, &argvp, NULL);
+ if (g_shell_parse_argv(line_read, &argcp, &argvp, NULL) == FALSE)
+ goto done;

for (i = 0; commands[i].cmd; i++)
if (strcasecmp(commands[i].cmd, argvp[0]) == 0)
--
1.7.9.5



2013-07-19 11:26:29

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH BlueZ] attrib: Fix interactive gatttool segfault

Hi Satish,

On Fri, Jul 19, 2013, Sathish Narasimman wrote:
> passing the special character single quote
>
> $gatttool -I
> [ ][ ][LE]> '
> Segmentation fault (core dumped)
>
> Checking g_shell_parse_argv fail status(return FALSE on failure), works fine.
>
> hope the fix to the previous "git am" error is solved
>
> ---
> attrib/interactive.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)

The patch has now been applied (after manually removing the last comment
that doesn't belong in the commit message). Thanks.

Johan

2013-07-19 11:03:56

by Anderson Lizardo

[permalink] [raw]
Subject: Re: [PATCH BlueZ] attrib: Fix interactive gatttool segfault

Hi Sathish,

On Fri, Jul 19, 2013 at 12:31 AM, Sathish Narasimman
<[email protected]> wrote:
> passing the special character single quote
>
> $gatttool -I
> [ ][ ][LE]> '
> Segmentation fault (core dumped)
>
> Checking g_shell_parse_argv fail status(return FALSE on failure), works fine.
>
> hope the fix to the previous "git am" error is solved

"git am" on this patch worked here. But one small note (for future
patches; I think there is no need to resend this one as it is easily
fixed locally): if you need to put a comment like the above that you
don't want to appear on the GIT commit message, you should put it
after "---" so it is ignored by "git am". They way I do this is use
"git format-patch" to generate a *.patch file, then I edit this file
to add the note after the "---" and send the patch using git send-mail
<file>.patch.

Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil