From 45294f6b07159da4bbb2de5fb6b77a8713f5dcaa Mon Sep 17 00:00:00 2001 From: Magnus Persson Date: Thu, 4 Aug 2022 16:17:24 +0200 Subject: [PATCH] Using strncat instead --- src/templating.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/templating.hpp b/src/templating.hpp index 9ca83d4..5a1ff8e 100644 --- a/src/templating.hpp +++ b/src/templating.hpp @@ -88,7 +88,7 @@ class TemplatingEngine { {TPL_TOKEN2, ""}, {TPL_APP_VER, ""}, {TPL_APP_BUILD, ""}}; - char _buffer[20]; + char _buffer[20] = ""; String _baseTemplate; char *_output = 0; @@ -153,13 +153,13 @@ class TemplatingEngine { _items[i].key.length()) == 0) { // Found key strncat(_output, format + k, j - k); - strcat(_output, _items[i].val.c_str()); + strncat(_output, _items[i].val.c_str(), _items[i].val.length()); k = j + _items[i].key.length(); } } } } - strcat(_output, format + k); + strncat(_output, format + k, strlen(format + k)); } void dumpAll() {