]> git.saurik.com Git - apple/cf.git/commitdiff
CF-368.28.tar.gz mac-os-x-10410ppc mac-os-x-10410x86 mac-os-x-1049ppc mac-os-x-1049x86 v368.28
authorApple <opensource@apple.com>
Tue, 27 Mar 2007 05:50:16 +0000 (05:50 +0000)
committerApple <opensource@apple.com>
Tue, 27 Mar 2007 05:50:16 +0000 (05:50 +0000)
NumberDate.subproj/CFTimeZone.c

index 1b758eed875d189b5b710f8b719338ced62d440f..f57c60a3314dc54bb76add90247235b006bbb1a6 100644 (file)
@@ -345,6 +345,9 @@ static Boolean __CFParseTimeZoneData(CFAllocatorRef allocator, CFDataRef data, C
     if (len < (int32_t)sizeof(struct tzhead)) {
        return false;
     }
+    
+    if (!(p[0] == 'T' && p[1] == 'Z' && p[2] == 'i' && p[3] == 'f')) return false;  /* Don't parse without TZif at head of file */
+    
     p += 20 + 4 + 4 + 4;       /* skip reserved, ttisgmtcnt, ttisstdcnt, leapcnt */
     timecnt = __CFDetzcode(p);
     p += 4;
@@ -861,6 +864,13 @@ static CFTimeZoneRef __CFTimeZoneCreateFixed(CFAllocatorRef allocator, int32_t s
     unsigned char dataBytes[52 + nameLen + 1];
 #endif
     memset(dataBytes, 0, sizeof(dataBytes));
+    
+    // Put in correct magic bytes for timezone structures
+    dataBytes[0] = 'T';
+    dataBytes[1] = 'Z';
+    dataBytes[2] = 'i';
+    dataBytes[3] = 'f';
+    
     __CFEntzcode(1, dataBytes + 20);
     __CFEntzcode(1, dataBytes + 24);
     __CFEntzcode(1, dataBytes + 36);