From patchwork Wed Nov 21 18:28:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 200821 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C743E2C0097 for ; Thu, 22 Nov 2012 05:29:29 +1100 (EST) Received: from localhost ([::1]:35708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbF39-0007b7-EK for incoming@patchwork.ozlabs.org; Wed, 21 Nov 2012 13:29:27 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbF2x-0007ao-GP for qemu-devel@nongnu.org; Wed, 21 Nov 2012 13:29:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbF2t-00058m-HV for qemu-devel@nongnu.org; Wed, 21 Nov 2012 13:29:15 -0500 Received: from smtp.citrix.com ([66.165.176.89]:30881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbF2t-00056K-5O for qemu-devel@nongnu.org; Wed, 21 Nov 2012 13:29:11 -0500 X-IronPort-AV: E=Sophos;i="4.83,293,1352073600"; d="scan'208";a="45329359" Received: from ftlpmailmx02.citrite.net ([10.13.107.66]) by FTLPIPO01.CITRIX.COM with ESMTP/TLS/RC4-MD5; 21 Nov 2012 18:29:09 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.66) with Microsoft SMTP Server id 8.3.279.1; Wed, 21 Nov 2012 13:29:09 -0500 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1TbF2q-0005Dq-Q1; Wed, 21 Nov 2012 18:29:08 +0000 Date: Wed, 21 Nov 2012 18:28:28 +0000 From: Stefano Stabellini X-X-Sender: sstabellini@kaball.uk.xensource.com To: qemu-devel@nongnu.org Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Cc: Paolo Bonzini , Stefano Stabellini Subject: [Qemu-devel] [PATCH] inet_parse: fix ,to= parsing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Fix inet_parse to parse the ",to=" command line option correctly. Signed-off-by: Stefano Stabellini diff --git a/qemu-sockets.c b/qemu-sockets.c index cfed9c5..f8740dd 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -529,8 +529,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 (1 != sscanf(h, "%d%n", &to, &pos) || + (h[pos] != '\0' && h[pos] != ',')) { error_setg(errp, "error parsing to= argument"); goto fail; }