-/* 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 {{{ */
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<uint8_t *>(temp));
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<const uint8_t *>(utf8.data));
uint16_t *rhs(temp);