1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-28 02:54:31 +03:00

CFStringGetBytes() does not set the NULL terminator

This commit is contained in:
Tae Won Ha 2020-01-04 19:46:22 +01:00
parent 322e4a3b76
commit f762678dd2
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44

View File

@ -373,7 +373,7 @@ static const char *cfstr2cstr(CFStringRef cfstr, bool *free_bytes) {
if (converted == 0 || out_len == 0) { return NULL; }
const char *result = malloc((size_t) (out_len + 1));
char *result = malloc((size_t) (out_len + 1));
converted = CFStringGetBytes(
cfstr,
whole_range,
@ -391,6 +391,7 @@ static const char *cfstr2cstr(CFStringRef cfstr, bool *free_bytes) {
}
*free_bytes = true;
result[out_len] = NULL;
return result;
}