]> git.proxmox.com Git - qemu.git/commit
rtc: fix overflow in mktimegm
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 1 Oct 2012 12:22:06 +0000 (14:22 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Fri, 30 Nov 2012 21:41:52 +0000 (15:41 -0600)
commit4843c928f92f6658e71bc100662be9bb585c7d1b
tree7263a803cf864b2196350b68fcf31b92df6bd68d
parenta106eaa3a6e6303fba80d763e806102fec28c943
rtc: fix overflow in mktimegm

When setting a date in 1980, Linux is actually disregarding the century
byte and setting the year to 2080.  This causes a year-2038 overflow
in mktimegm.  Fix this by doing the days-to-seconds computation in
64-bit math.

Reported-by: Lucas Meneghel Rodrigues <lookkas@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit b6db4aca20e9af4f62c9c9e08b9b9672a6ed3390)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
cutils.c
tests/rtc-test.c