Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -63,15 +63,14 @@ return; } ulen = [self length]; - ustr = [self allocMemoryForNItems: [self length] - withSize: ulen]; + ustr = [self allocMemoryForNItems: ulen + withSize: sizeof(of_unichar_t)]; - i = 0; - j = 0; + i = j = 0; nlen = 0; while (i < length) { clen = of_string_utf8_to_unicode(string + i, length - i, &c);