From 2d35a720b9f997d08dd3da5441fc7ce889135a05 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 19 Oct 2016 14:38:48 +0200 Subject: [PATCH] vtysh: fix oversight in vtysh buffer rewrite end can be NULL and shouldn't be adjusted in that case. Signed-off-by: David Lamparter --- vtysh/vtysh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index aaf3f828c4..4b579ddbdb 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -185,7 +185,8 @@ vtysh_client_run (struct vtysh_client *vclient, const char *line, FILE *fp) memmove (buf, eol, bufvalid - eol); bufvalid -= eol - buf; - end -= eol - buf; + if (end) + end -= eol - buf; } if (bufvalid == buf + bufsz)