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:
parent
322e4a3b76
commit
f762678dd2
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user