[nftables PATCH] fix nft -i command crashes when try to input multi line command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
---
 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
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux