From cb91891f2209aa66afa72e055b2efd5aef496eb4 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 16 Sep 2016 16:18:50 -0400 Subject: [PATCH] check buffer size --- Family.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Family.cpp b/Family.cpp index ff09f2f5..c1840e51 100644 --- a/Family.cpp +++ b/Family.cpp @@ -114,6 +114,12 @@ namespace data { uint8_t buf[50], signatureBuf[64]; size_t len = family.length (), signatureLen = strlen (signature); + if (len + 32 > 50) + { + LogPrint (eLogError, "Family: ", family, " is too long"); + return false; + } + memcpy (buf, family.c_str (), len); memcpy (buf + len, (const uint8_t *)ident, 32); len += 32;