Skip to content

Commit 8d68c89

Browse files
authored
Merge pull request #2738 from drexin/wip-backport-timezone
[5.2] Backport: Don't try to follow relative links in __CFTimeZoneCreateSystem
2 parents ae27e1e + f0ecc29 commit 8d68c89

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

CoreFoundation/NumberDate.subproj/CFTimeZone.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,8 @@ static CFTimeZoneRef __CFTimeZoneCreateSystem(void) {
865865
#if !TARGET_OS_ANDROID
866866
if (!__tzZoneInfo) __InitTZStrings();
867867
ret = readlink(TZDEFAULT, linkbuf, sizeof(linkbuf));
868-
if (__tzZoneInfo && (0 < ret)) {
868+
// The link can be relative, we treat this the same as if there was no link
869+
if (__tzZoneInfo && (0 < ret) && (linkbuf[0] != '.')) {
869870
linkbuf[ret] = '\0';
870871
const char *tzZoneInfo = CFStringGetCStringPtr(__tzZoneInfo, kCFStringEncodingASCII);
871872
size_t zoneInfoDirLen = CFStringGetLength(__tzZoneInfo);

0 commit comments

Comments
 (0)