From 9a445c18bb633658c8ca54cd9e20bd9c745ae712 Mon Sep 17 00:00:00 2001 From: Vindaar Date: Wed, 3 Oct 2018 19:53:09 +0200 Subject: [PATCH] fix `assertStringEqual` to make sure not to access null terminator --- test/tserialization.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tserialization.nim b/test/tserialization.nim index 0baa7bb..c16e6d1 100644 --- a/test/tserialization.nim +++ b/test/tserialization.nim @@ -97,7 +97,7 @@ proc constructObject*(s: var YamlStream, c: ConstructionContext, result = BetterInt(parseBiggestInt(item.scalarContent) + 1) template assertStringEqual(expected, actual: string) = - for i in countup(0, min(expected.len, actual.len)): + for i in countup(0, min(expected.len, actual.len) - 1): if expected[i] != actual[i]: echo "string mismatch at character #", i, "(expected:\'", expected[i], "\', was \'", actual[i], "\'):"