From 6d22ae06cbdf21fabe197a4adb842ed65fd7f150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 12 Aug 2014 19:30:09 +0200 Subject: [PATCH] Fix substring operator in macro-processor. The characters of the substring could be mixed with random characters from the memory space. Thanks to Tom Holden for reporting the bug. Closes #708 --- macro/MacroValue.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macro/MacroValue.cc b/macro/MacroValue.cc index 65b3fc39..3dfab323 100644 --- a/macro/MacroValue.cc +++ b/macro/MacroValue.cc @@ -387,7 +387,7 @@ StringMV::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsEr if (*it < 1 || *it > (int) value.length()) throw OutOfBoundsError(); char c = value.at(*it - 1); - result.append(&c); + result.append(1, c); } return new StringMV(driver, result); }