On Wed, Oct 29, 2014 at 2:08 AM, Gonglei <arei.gong...@huawei.com> wrote: > On 2014/10/28 22:29, Stefan Hajnoczi wrote: > >> 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). >>> >>> 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. >>> >>> Example error message after this change has been applied: >>> >>> $ ./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 >>> too large or negative: Invalid argument >>> >>> Signed-off-by: Richard W.M. Jones <rjo...@redhat.com> >>> --- >>> 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 > > Please don't, the patch had been posted v2 which is better: > > [PATCH v2] block/curl: Improve type safety of s->timeout. > http://lists.gnu.org/archive/html/qemu-devel/2014-10/msg03112.html
Sorry, I missed that thread because the cover letter has no 0/N numbering as required in: http://qemu-project.org/Contribute/SubmitAPatch Numbering is a hard requirement so tools know how many emails to wait for before processing emails. The "patches" tool (https://github.com/stefanha/patches/) rejects series that have no numbering. Single patch emails without a cover letter or numbering are fine, too. Stefan