summaryrefslogtreecommitdiff
path: root/lib/String.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/String.cc')
-rw-r--r--lib/String.cc6
1 files changed, 4 insertions, 2 deletions
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;
}