Matrix: adjust buffer size calculation to account for additional characters

Note: If the buffer is too small there's no memory corruption because of the snprintf limit but part of the output gets missing.
This commit is contained in:
Matthias Grob
2017-10-17 17:37:23 +02:00
parent 0a772f59dd
commit 0527471a52
+1 -1
View File
@@ -286,7 +286,7 @@ public:
void print() const
{
static const size_t n = 10*N*M;
static const size_t n = 11*N*M + M; // for every entry a tab and 10 digits, for every row a newline
char * buf = new char[n];
write_string(buf, n);
printf("%s\n", buf);