On 10/26/2015 04:06 PM, John Snow wrote: > cvtnum() returns int64_t: we should not be storing this > result inside of an int. > > In a few cases, we need an extra sprinkling of error handling > where we expect to pass this number on towards a function that > expects something smaller than int64_t. > > Signed-off-by: John Snow <js...@redhat.com> > --- > qemu-io-cmds.c | 30 ++++++++++++++++-------------- > 1 file changed, 16 insertions(+), 14 deletions(-) >
> @@ -2191,10 +2190,13 @@ static const cmdinfo_t sigraise_cmd = { > > static int sigraise_f(BlockBackend *blk, int argc, char **argv) > { > - int sig = cvtnum(argv[1]); > + int64_t sig = cvtnum(argv[1]); > if (sig < 0) { > printf("non-numeric signal number argument -- %s\n", argv[1]); > return 0; Pre-existing: attempting to raise signal -1 claims that -1 is non-numeric. Not the end of the world. > + } else if (sig > INT_MAX) { > + printf("signal argument '%s' is too large\n", argv[1]); > + return 0; > } Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature