From cb047c013df0eaf1c5e9edd67bbb6b6fa537d2a0 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 12 May 2010 03:12:14 -0400 Subject: A string was not terminated with a NUL. --- src/expr.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/expr.cc b/src/expr.cc index 8fed2b14..f3a30de6 100644 --- a/src/expr.cc +++ b/src/expr.cc @@ -46,14 +46,19 @@ void expr_t::parse(std::istream& in, const parse_flags_t& flags, if (original_string) { set_text(*original_string); - } else { + } + else if (end_pos > start_pos) { in.clear(); in.seekg(start_pos, std::ios::beg); scoped_array buf (new char[static_cast(end_pos - start_pos) + 1]); in.read(buf.get(), end_pos - start_pos); + buf[end_pos - start_pos] = '\0'; set_text(buf.get()); } + else { + set_text(""); + } } void expr_t::compile(scope_t& scope) -- cgit v1.2.3