From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj7m6-0003PS-P5 for qemu-devel@nongnu.org; Tue, 28 Oct 2014 10:29:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xj7m1-0002Hd-Ao for qemu-devel@nongnu.org; Tue, 28 Oct 2014 10:29:30 -0400 Received: from mail-lb0-x22b.google.com ([2a00:1450:4010:c04::22b]:52524) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj7m1-0002HV-3G for qemu-devel@nongnu.org; Tue, 28 Oct 2014 10:29:25 -0400 Received: by mail-lb0-f171.google.com with SMTP id z11so716495lbi.16 for ; Tue, 28 Oct 2014 07:29:24 -0700 (PDT) Date: Tue, 28 Oct 2014 14:29:20 +0000 From: Stefan Hajnoczi Message-ID: <20141028142920.GD22805@stefanha-thinkpad.redhat.com> References: <1412605930-3397-1-git-send-email-rjones@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J5MfuwkIyy7RmF4Q" Content-Disposition: inline In-Reply-To: <1412605930-3397-1-git-send-email-rjones@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block/curl: Improve type safety of s->timeout. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Richard W.M. Jones" Cc: kwolf@redhat.com, lersek@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com --J5MfuwkIyy7RmF4Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 06, 2014 at 03:32:10PM +0100, Richard W.M. Jones wrote: > qemu_opt_get_number returns a uint64_t, and curl_easy_setopt expects a > long (not an int). >=20 > Store the timeout (which is a positive number of seconds) as a > uint64_t. Check that the number given by the user is reasonable. > Cast it to long before calling curl_easy_setopt. >=20 > Example error message after this change has been applied: >=20 > $ ./qemu-img create -f qcow2 /tmp/test.qcow2 \ > -b 'json: { "file.driver":"https", > "file.url":"https://foo/bar", > "file.timeout":-1 }' > qemu-img: /tmp/test.qcow2: Could not open 'json: { "file.driver":"https",= "file.url":"https://foo/bar", "file.timeout":-1 }': timeout parameter is t= oo large or negative: Invalid argument >=20 > Signed-off-by: Richard W.M. Jones > --- > block/curl.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) Thanks, applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan --J5MfuwkIyy7RmF4Q Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUT6hAAAoJEJykq7OBq3PI+hYH/2jrsXoqUXOIOzOaOiilgZrq vz5roV73VRgie2UUL81PvIZ/yuexkrKcY0Eg8HubeiS6GxgPhMama7gpBXju/beP ELaVf96bcgWAO4clRcHs6yIbiJXt2tY0jzPogXNP8u9e0Tz1DKcevBLN+ZFdu+9E cOcCbD+VKVA2vn2/Z0WL3vEaw6WE92JpcfUTRzavCE3vGhN6OwHXIRn3jtqFgeyk I3wOso/JUZ0uo63d/3P3Y0GEvsGaPnHks6aIclKPrDBtzRxeQDHo2iNAZorVREti GGeJOFBnqUZ8UW8bVpEKL8w7OdYenYRVdsdX5E2PWA0jw3tXYaDi8CVutYqTESE= =Cgkj -----END PGP SIGNATURE----- --J5MfuwkIyy7RmF4Q--