From 6a0c28cb3dabbd7ddef1e4b1538c4040ed6c07cf Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Tue, 25 Sep 2018 18:46:05 -0400 Subject: [PATCH] Got rid of a strcpy --- api/icsneoc/icsneoc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/icsneoc/icsneoc.cpp b/api/icsneoc/icsneoc.cpp index 80b4a3a..fe305f5 100644 --- a/api/icsneoc/icsneoc.cpp +++ b/api/icsneoc/icsneoc.cpp @@ -56,7 +56,8 @@ bool icsneoSerialNumToString(uint32_t num, char* str, size_t* count) { *count = result.length() + 1; // This is how big of a buffer we need return false; } - strcpy(str, result.c_str()); // TODO bad + strncpy(str, result.c_str(), *count); + str[*count - 1] = '\0'; *count = result.length(); return true; }