Patchwork [V2] qemu-sockets: Fix parsing of the inet option 'to'.

login
register
mail settings
Submitter Anthony PERARD
Date Nov. 9, 2012, 11:50 a.m.
Message ID <1352461854-18195-1-git-send-email-anthony.perard@citrix.com>
Download mbox | patch
Permalink /patch/198030/
State New
Headers show

Comments

Anthony PERARD - Nov. 9, 2012, 11:50 a.m.
Having a qemu command line argument like "-vnc 127.0.0.1:0,to=99" is broken.
This have been break with commit 879e45c72da1569e07fbbc6a1aa2a708ea796044.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

---
 qemu-sockets.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Markus Armbruster - Nov. 12, 2012, 1:45 p.m.
Anthony PERARD <anthony.perard@citrix.com> writes:

> Having a qemu command line argument like "-vnc 127.0.0.1:0,to=99" is broken.
> This have been break with commit 879e45c72da1569e07fbbc6a1aa2a708ea796044.
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks for taking the time to identify the commit that broke it.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Stefan Hajnoczi - Nov. 16, 2012, 1:44 p.m.
On Fri, Nov 09, 2012 at 11:50:54AM +0000, Anthony PERARD wrote:
> Having a qemu command line argument like "-vnc 127.0.0.1:0,to=99" is broken.
> This have been break with commit 879e45c72da1569e07fbbc6a1aa2a708ea796044.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> ---
>  qemu-sockets.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

Patch

diff --git a/qemu-sockets.c b/qemu-sockets.c
index abcd791..03ca98d 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -551,8 +551,9 @@  static InetSocketAddress *inet_parse(const char *str, Error **errp)
     optstr = str + pos;
     h = strstr(optstr, ",to=");
     if (h) {
-        if (1 != sscanf(str, "%d%n", &to, &pos) ||
-            (str[pos] != '\0' && str[pos] != ',')) {
+        h += 4;
+        if (sscanf(h, "%d%n", &to, &pos) != 1 ||
+            (h[pos] != '\0' && h[pos] != ',')) {
             error_setg(errp, "error parsing to= argument");
             goto fail;
         }