mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 01:33:34 +08:00
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:
+1
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user