From f82b19e21f90e04f46b1c752e0ddc1ade58877be Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 22 Aug 2020 12:03:24 -0400 Subject: [PATCH] Fix off-by-one mistake, Fixes #2300 --- tools/binary2txt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/binary2txt.cpp b/tools/binary2txt.cpp index 8c6c978829..fcfb4729fd 100644 --- a/tools/binary2txt.cpp +++ b/tools/binary2txt.cpp @@ -158,7 +158,7 @@ int main(int narg, char **arg) delete [] unit_style; unit_style = new char[len+1]; fread(unit_style, sizeof(char), len, fp); - unit_style[len+1] = '\0'; + unit_style[len] = '\0'; fprintf(fptxt, "ITEM: UNITS\n"); fprintf(fptxt, "%s\n", unit_style); } @@ -176,7 +176,7 @@ int main(int narg, char **arg) delete [] columns; columns = new char[len+1]; fread(columns, sizeof(char), len, fp); - columns[len+1] = '\0'; + columns[len] = '\0'; } fread(&nchunk,sizeof(int),1,fp);