summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-04-11 10:21:35 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-04-11 10:23:02 +0200
commit3e4d73cf00d919422e31037c967371e2563801bc (patch)
treeb2bae63a6627ab2de6dd3e141013af65d708adf3
parent9a000499989f22ac26ab20b684848ed9b415928f (diff)
cli: Drop String termination workaround
This spot was missed by commit 2b3f18e0cf7a7 ("libnftables: Fix for input without trailing newline") - since line termination is now added in nft_run_cmd_from_buffer(), cli is relieved from doing so. Fixes: 2b3f18e0cf7a7 ("libnftables: Fix for input without trailing newline") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/cli.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/cli.c b/src/cli.c
index eb60d01d..241ea010 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -83,8 +83,6 @@ static void cli_complete(char *line)
const HIST_ENTRY *hist;
const char *c;
LIST_HEAD(msgs);
- int len;
- char *s;
if (line == NULL) {
printf("\n");
@@ -112,13 +110,7 @@ static void cli_complete(char *line)
if (hist == NULL || strcmp(hist->line, line))
add_history(line);
- len = strlen(line);
- s = xmalloc(len + 2);
- snprintf(s, len + 2, "%s\n", line);
- xfree(line);
- line = s;
-
- nft_run_cmd_from_buffer(cli_nft, line, len + 2);
+ nft_run_cmd_from_buffer(cli_nft, line, strlen(line) + 1);
xfree(line);
}