mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-23 13:09:58 +08:00
Linux: Fix UTC offset setting in settimeofday for __TIMESIZE != 64
The time argument is NULL in this case, and attempt to convert it
leads to a null pointer dereference.
This fixes commit d2e3b697da
("y2038: linux: Provide __settimeofday64 implementation").
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
354b98cdfd
commit
5f40e4b1ba
@ -25,6 +25,7 @@
|
||||
int
|
||||
__settimeofday64 (const struct __timeval64 *tv, const struct timezone *tz)
|
||||
{
|
||||
/* Backwards compatibility for setting the UTC offset. */
|
||||
if (__glibc_unlikely (tz != 0))
|
||||
{
|
||||
if (tv != 0)
|
||||
@ -45,9 +46,13 @@ libc_hidden_def (__settimeofday64)
|
||||
int
|
||||
__settimeofday (const struct timeval *tv, const struct timezone *tz)
|
||||
{
|
||||
struct __timeval64 tv64 = valid_timeval_to_timeval64 (*tv);
|
||||
|
||||
return __settimeofday64 (&tv64, tz);
|
||||
if (__glibc_unlikely (tv == NULL))
|
||||
return __settimeofday64 (NULL, tz);
|
||||
else
|
||||
{
|
||||
struct __timeval64 tv64 = valid_timeval_to_timeval64 (*tv);
|
||||
return __settimeofday64 (&tv64, tz);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
weak_alias (__settimeofday, settimeofday);
|
||||
|
Loading…
Reference in New Issue
Block a user