diff options
author | John Wiegley <johnw@newartisans.com> | 2010-05-12 03:12:14 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-05-12 03:12:31 -0400 |
commit | cb047c013df0eaf1c5e9edd67bbb6b6fa537d2a0 (patch) | |
tree | 846efb794cb76fdc4c63fa4c6ab554b83af49f07 /src/expr.cc | |
parent | 04cfa7ab715f66be75d74de93510c62a6cea62a4 (diff) | |
download | fork-ledger-cb047c013df0eaf1c5e9edd67bbb6b6fa537d2a0.tar.gz fork-ledger-cb047c013df0eaf1c5e9edd67bbb6b6fa537d2a0.tar.bz2 fork-ledger-cb047c013df0eaf1c5e9edd67bbb6b6fa537d2a0.zip |
A string was not terminated with a NUL.
Diffstat (limited to 'src/expr.cc')
-rw-r--r-- | src/expr.cc | 7 |
1 files changed, 6 insertions, 1 deletions
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<char> buf (new char[static_cast<std::size_t>(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("<stream>"); + } } void expr_t::compile(scope_t& scope) |