diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2010-11-28 09:28:18 +0100 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2010-11-28 09:28:18 +0100 |
commit | c02c5e3c43d1a0a87b541f106f7527abea934696 (patch) | |
tree | 03e38ccc90e86896a4f20cda130931eaecdeced8 | |
parent | 4303be8a4c343ad9085c2857cabc8e55f3bac525 (diff) |
Workarounding String::strdup's issue on truncated sizes.
-rw-r--r-- | lib/String.cc | 6 |
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; } |