Skip to content

Commit bc4cabb

Browse files
committed
Jira for CFStringGetCString() crash with zero length strings
1 parent 6213cba commit bc4cabb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

CoreFoundation/Base.subproj/CFUtilities.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ void CFLog1(CFLogLevel lev, CFStringRef message) {
783783
char *buf = message ? (char *)malloc(blen) : 0;
784784
if (buf) {
785785
if (blen == 1)
786+
// was crashing with zero length strings
787+
// https://bugs.swift.org/browse/SR-2666
786788
buf[0] = '\000';
787789
else
788790
CFStringGetCString(message, buf, blen, kCFStringEncodingUTF8);

0 commit comments

Comments
 (0)