summaryrefslogtreecommitdiffstats
path: root/commands/readline.c
diff options
context:
space:
mode:
Diffstat (limited to 'commands/readline.c')
-rw-r--r--commands/readline.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/commands/readline.c b/commands/readline.c
index 403ac8563a..57c8fbd7bc 100644
--- a/commands/readline.c
+++ b/commands/readline.c
@@ -10,14 +10,16 @@
static int do_readline(int argc, char *argv[])
{
- char *buf = xzalloc(CONFIG_CBSIZE);
+ char *buf;
if (argc < 3)
return COMMAND_ERROR_USAGE;
+ buf = xzalloc(CONFIG_CBSIZE);
+
command_slice_release();
- if (readline(argv[1], buf, CONFIG_CBSIZE) < 0) {
+ if (readline(argv[1], buf, CONFIG_CBSIZE - 1) < 0) {
command_slice_acquire();
free(buf);
return COMMAND_ERROR;