netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nftables PATCH] fix nft -i command crashes when try to input multi line command
@ 2014-06-07 19:14 Guruswamy B
  2014-06-10 10:55 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 5+ messages in thread
From: Guruswamy B @ 2014-06-07 19:14 UTC (permalink / raw)
  To: netfilter-devel

Hello,
 When try to input multiline command in "nft -i", it crashes.

 Issue is, function "cli_append_multiline" return null in case of
multiline command,
 But in the calling function "cli_complete", cli_exit is getting
called, which in turn calls "rl_callback_handler_remove"  and the
handler is getting removed.


Signed-off-by: Guruswamy Basavaiah <guru2018@gmail.com>
---
---
 src/cli.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/cli.c b/src/cli.c
index 8875207..c0051a5 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -66,6 +66,7 @@ static char *cli_append_multiline(char *line)
        multiline = line;
        rl_save_prompt();
        rl_clear_message();
+       rl_set_prompt(">");
    } else {
        len += strlen(multiline);
        s = xmalloc(len + 1);
@@ -89,12 +90,15 @@ static void cli_complete(char *line)
    const char *c;
    LIST_HEAD(msgs);

-   line = cli_append_multiline(line);
    if (line == NULL) {
        printf("\n");
        cli_exit();
-       return;
+       exit(0);
    }
+
+   line = cli_append_multiline(line);
+   if(line == NULL)
+       return;

    for (c = line; *c != '\0'; c++)
        if (!isspace(*c))
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-10 15:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-07 19:14 [nftables PATCH] fix nft -i command crashes when try to input multi line command Guruswamy B
2014-06-10 10:55 ` Pablo Neira Ayuso
2014-06-10 11:05   ` Guruswamy Basavaiah
2014-06-10 11:22     ` Pablo Neira Ayuso
2014-06-10 15:21       ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).