make sure the hour we read from the time zone file is constrained to 0-23

This commit is contained in:
Richard Frith-Macdonald 2018-02-04 11:21:47 +00:00
parent b135bc8ae0
commit 54bf6598ed
2 changed files with 7 additions and 2 deletions

View file

@ -7,6 +7,7 @@
collation alone beng set.
* Source/GSString.m: better handling if character conversion fails.
* Source/NSRunLoop.m: suppress warning using cast.
* Source/NSTimeZone.m: check that time zone hour is in range 0 to 23
2018-01-26 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -1871,6 +1871,10 @@ localZoneString, [zone name], sign, s/3600, (s/60)%60);
}
while (fscanf(fp, "%d %s", &index, name) == 2)
{
if (index < 0)
index = 0;
else
index %= 24;
[temp_array[index]
addObject: [NSString stringWithUTF8String: name]];
}
@ -1895,8 +1899,8 @@ localZoneString, [zone name], sign, s/3600, (s/60)%60);
path = [zonedir stringByAppendingPathComponent: name];
if ([mgr fileExistsAtPath: path isDirectory: &isDir]
&& isDir == NO
&& [[path pathExtension] isEqual: @"tab"] == NO)
&& isDir == NO
&& [[path pathExtension] isEqual: @"tab"] == NO)
{
zone = [zoneDictionary objectForKey: name];
if (zone == nil)