From e7eec05a73efd15027a4773ae5b3b9a4427b0a7b Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Wed, 6 Jun 2018 01:10:57 +0200 Subject: Fix memmove length --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 10209d7..75f130c 100644 --- a/main.c +++ b/main.c @@ -308,6 +308,7 @@ int main(int argc, char *argv[]) break; } curPos += count; + buf[curPos] = '\0'; } *newlinePos = '\0'; @@ -452,9 +453,10 @@ int main(int argc, char *argv[]) fputs("KILLED\n", ctrloutFile); } } + if(newlinePos != 0) { - memmove(buf, newlinePos + 1, strlen(newlinePos + 1)); + memmove(buf, newlinePos + 1, strlen(newlinePos + 1) + 1); } else { -- cgit v1.2.3-54-g00ecf