From 7ab728e996cd25fe7007a144c04b9cc5c56d7522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Blanchon?= Date: Thu, 26 Jun 2014 13:00:14 +0200 Subject: [PATCH] Added a test that appends a string longer that the capacity of the builder --- JsonGeneratorTests/StringBuilder.cpp | 9 ++++++--- JsonGeneratorTests/StringBuilder.h | 6 +++--- JsonGeneratorTests/StringBuilderTests.cpp | 6 ++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/JsonGeneratorTests/StringBuilder.cpp b/JsonGeneratorTests/StringBuilder.cpp index d9e3167a..af4b2b98 100644 --- a/JsonGeneratorTests/StringBuilder.cpp +++ b/JsonGeneratorTests/StringBuilder.cpp @@ -10,9 +10,12 @@ void StringBuilder::append(const char* s) { char* tail = buffer + length; - strncpy(tail, s, capacity - length); + while (*s && length