From c02c5e3c43d1a0a87b541f106f7527abea934696 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Sun, 28 Nov 2010 09:28:18 +0100 Subject: Workarounding String::strdup's issue on truncated sizes. --- lib/String.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/String.cc') diff --git a/lib/String.cc b/lib/String.cc index 14195f6..28a3fff 100644 --- a/lib/String.cc +++ b/lib/String.cc @@ -276,8 +276,10 @@ String String::extract(size_t from, ssize_t to) const { char * String::strdup(size_t from, ssize_t to) const { char * r; - r = Base::strdup(to_charp(from, to)); - + r = Base::strdup(to_charp(from, -1)); + to -= from; + if ((to >= 0) && (to < (siz - from))) + r[to] = 0; return r; } -- cgit v1.2.3