qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in st


From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()/strtoull()
Date: Fri, 27 Apr 2012 10:26:57 -0300

On Fri, 27 Apr 2012 15:24:51 +0200
Markus Armbruster <address@hidden> wrote:

> Luiz Capitulino <address@hidden> writes:
> 
> > On Fri, 27 Apr 2012 06:22:48 -0600
> > Eric Blake <address@hidden> wrote:
> >
> >> On 04/27/2012 03:04 AM, Markus Armbruster wrote:
> >> > Luiz Capitulino <address@hidden> writes:
> >> > 
> >> >> It's not checked currently, so something like:
> >> >>
> >> 
> >> >> +++ b/monitor.c
> >> >> @@ -3120,10 +3120,17 @@ static int64_t expr_unary(Monitor *mon)
> >> >>          n = 0;
> >> >>          break;
> >> >>      default:
> >> >> +        errno = 0;
> >> >>  #if TARGET_PHYS_ADDR_BITS > 32
> >> >>          n = strtoull(pch, &p, 0);
> >> >> +        if (n == ULLONG_MAX && errno == ERANGE) {
> >> >> +            expr_error(mon, "number too large");
> >> >> +        }
> >> > 
> >> > The test n == ULLONG_MAX is redundant.
> >> 
> >> But harmless.
> >
> > Yes, and I prefer to comply to the standard (as there's no strong
> > reason not to do so).
> 
> What standard?

http://pubs.opengroup.org/onlinepubs/009695399/functions/strtoul.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]