From d8c063ae506e1cc303c0c674bd167542d57604a0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 18 Sep 2017 20:33:36 +0200 Subject: [PATCH] CID 172474 + 173899 Copy into fixed size buffer --- src/keyword.c | 3 ++- src/util/umlaut.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/keyword.c b/src/keyword.c index cb56fe940..a38c91e07 100644 --- a/src/keyword.c +++ b/src/keyword.c @@ -2,6 +2,7 @@ #include #include "keyword.h" +#include #include #include #include @@ -20,7 +21,7 @@ const char * keyword(keyword_t kwd) if (!result[0]) { strcpy(result, "keyword::"); } - strcpy(result + 9, keywords[kwd]); + strlcpy(result + 9, keywords[kwd], sizeof(result) - 9); return result; } diff --git a/src/util/umlaut.c b/src/util/umlaut.c index d29cb78ac..27f7bc67d 100644 --- a/src/util/umlaut.c +++ b/src/util/umlaut.c @@ -21,6 +21,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "assert.h" #include "log.h" +#include "bsdstring.h" #include "unicode.h" #include @@ -211,7 +212,7 @@ void addtoken(tnode ** root, const char *str, variant id) if (lcs == replace[i].ucs) { char zText[1024]; memcpy(zText, replace[i].str, 3); - strcpy(zText + 2, (const char *)str + len); + strlcpy(zText + 2, (const char *)str + len, sizeof(zText)-2); addtoken(root, zText, id); break; }