X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/802803686574eb6fc9846650c301b583e8e4f74d..f57a1abfff018977638649483e0bf259c830daf2:/Library.cpp?ds=sidebyside diff --git a/Library.cpp b/Library.cpp index 942ae8e..174ca67 100644 --- a/Library.cpp +++ b/Library.cpp @@ -1,5 +1,5 @@ -/* Cycript - Optimizing JavaScript Compiler/Runtime - * Copyright (C) 2009-2015 Jay Freeman (saurik) +/* Cycript - The Truly Universal Scripting Language + * Copyright (C) 2009-2016 Jay Freeman (saurik) */ /* GNU Affero General Public License, Version 3 {{{ */ @@ -43,7 +43,7 @@ CYUTF8String CYPoolUTF8String(CYPool &pool, CYUTF16String utf16) { // XXX: this is wrong size_t size(utf16.size * 5); - char *temp(new(pool) char[size]); + char *temp(new(pool) char[size + 1]); const uint16_t *lhs(utf16.data); uint8_t *rhs(reinterpret_cast(temp)); @@ -56,7 +56,7 @@ CYUTF8String CYPoolUTF8String(CYPool &pool, CYUTF16String utf16) { CYUTF16String CYPoolUTF16String(CYPool &pool, CYUTF8String utf8) { // XXX: this is wrong size_t size(utf8.size * 5); - uint16_t *temp(new (pool) uint16_t[size]); + uint16_t *temp(new (pool) uint16_t[size + 1]); const uint8_t *lhs(reinterpret_cast(utf8.data)); uint16_t *rhs(temp);