[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] qga: add windows implementation for guest-s
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] qga: add windows implementation for guest-set-time |
Date: |
Fri, 08 Mar 2013 13:11:11 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130219 Thunderbird/17.0.3 |
On 03/08/2013 09:56 AM, Lei Li wrote:
> Signed-off-by: Lei Li <address@hidden>
> ---
> qga/commands-win32.c | 35 +++++++++++++++++++++++++++++++++++
> 1 files changed, 35 insertions(+), 0 deletions(-)
>
> +
> + time = time_ns / 100 + W32_FT_OFFSET;
> + /* FILETIME values should be less than 0x8000000000000000
> + for function FileTimeToSystemTime. */
> + if (time & 0x8000000000000000) {
> + error_setg(errp, "Time %" PRId64 "is too large", time);
> + return;
> + }
That doesn't cover all cases of overflow. Better would be:
if (time_ns < 0 || time_ns / 100 > INT64_MAX - W32_FT_OFFSET) {
error ...
}
time = time_ns / 100 + W32_FT_OFFSET;
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature