Check tzspec_len == 0 in __tzfile_read

[BZ#18333]
	* time/tzset.c (__tzfile_read): Check tzspec_len == 0.
This commit is contained in:
H.J. Lu 2015-04-27 09:57:51 -07:00
parent cc8dcf96e7
commit 5cffc05ed5
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2015-04-27 H.J. Lu <hongjiu.lu@intel.com>
[BZ#18333]
* time/tzset.c (__tzfile_read): Check tzspec_len == 0.
2015-04-27 Florian Weimer <fweimer@redhat.com>
[BZ#18333]

View File

@ -270,7 +270,8 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
if (__glibc_unlikely (tzspec_len == 0 || tzspec_len - 1 < num_isgmt))
goto lose;
tzspec_len -= num_isgmt + 1;
if (__glibc_unlikely (SIZE_MAX - total_size < tzspec_len))
if (__glibc_unlikely (tzspec_len == 0
|| SIZE_MAX - total_size < tzspec_len))
goto lose;
}
if (__glibc_unlikely (SIZE_MAX - total_size - tzspec_len < extra))