summaryrefslogtreecommitdiff
path: root/examples/c-analysed/c-analysed.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/c-analysed/c-analysed.c')
-rw-r--r--examples/c-analysed/c-analysed.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/c-analysed/c-analysed.c b/examples/c-analysed/c-analysed.c
index e9c71b978..3f48a01d8 100644
--- a/examples/c-analysed/c-analysed.c
+++ b/examples/c-analysed/c-analysed.c
@@ -8,7 +8,8 @@
#include "utils.h"
#define MIN(a, b) (a > b ? b : a)
-#define BUFFER_REMAINING(siz) (NETWORK_BUFFER_MAX_SIZE / 3 - siz)
+#define BUFFER_MAX (NETWORK_BUFFER_MAX_SIZE / 3)
+#define BUFFER_REMAINING(siz) (BUFFER_MAX - siz)
typedef char csv_buf_t[(NETWORK_BUFFER_MAX_SIZE / 3) + 1];
static int main_thread_shutdown = 0;
@@ -155,7 +156,7 @@ static void csv_buf_add(csv_buf_t buf, size_t * const csv_buf_used, char const *
{
return;
}
- strncat(buf, str, len);
+ snprintf(buf + *csv_buf_used, BUFFER_MAX - len, "%.*s", (int)len, str);
}
else
{