|
@@ -166,7 +166,9 @@ void log_system_info(void)
|
|
static bool dstr_from_cfstring(struct dstr *str, CFStringRef ref)
|
|
static bool dstr_from_cfstring(struct dstr *str, CFStringRef ref)
|
|
{
|
|
{
|
|
CFIndex length = CFStringGetLength(ref);
|
|
CFIndex length = CFStringGetLength(ref);
|
|
- CFIndex max_size = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
|
|
|
|
|
|
+ CFIndex max_size = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8) + 1;
|
|
|
|
+ assert(max_size > 0);
|
|
|
|
+
|
|
dstr_reserve(str, max_size);
|
|
dstr_reserve(str, max_size);
|
|
|
|
|
|
if (!CFStringGetCString(ref, str->array, max_size, kCFStringEncodingUTF8))
|
|
if (!CFStringGetCString(ref, str->array, max_size, kCFStringEncodingUTF8))
|