From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw8rO-0004DM-Bn for qemu-devel@nongnu.org; Mon, 17 Oct 2016 10:25:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bw8rN-0008DB-9n for qemu-devel@nongnu.org; Mon, 17 Oct 2016 10:25:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47282) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bw8rN-0008Cu-29 for qemu-devel@nongnu.org; Mon, 17 Oct 2016 10:25:49 -0400 References: <1476435656-3100-1-git-send-email-stefanha@redhat.com> <1476435656-3100-4-git-send-email-stefanha@redhat.com> <20161016133526.GA13844@stefanha-x1.localdomain> From: Eric Blake Message-ID: Date: Mon, 17 Oct 2016 09:25:46 -0500 MIME-Version: 1.0 In-Reply-To: <20161016133526.GA13844@stefanha-x1.localdomain> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nrSwUOat93vwA381j3sJaLB8bB3IRq7OK" Subject: Re: [Qemu-devel] [PATCH v2 3/4] sockets: add AF_VSOCK support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --nrSwUOat93vwA381j3sJaLB8bB3IRq7OK From: Eric Blake To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, Michael Roth Message-ID: Subject: Re: [Qemu-devel] [PATCH v2 3/4] sockets: add AF_VSOCK support References: <1476435656-3100-1-git-send-email-stefanha@redhat.com> <1476435656-3100-4-git-send-email-stefanha@redhat.com> <20161016133526.GA13844@stefanha-x1.localdomain> In-Reply-To: <20161016133526.GA13844@stefanha-x1.localdomain> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/16/2016 08:35 AM, Stefan Hajnoczi wrote: >>> + >>> + if (sscanf(str, "%32[^:]:%32[^,]%n", cid, port, &n) !=3D 2) { >> >> This says stop at the first comma after the colon... >> >>> + error_setg(errp, "error parsing address '%s'", str); >>> + return NULL; >>> + } >>> + if (str[n] !=3D '\0') { >>> + error_setg(errp, "trailing characters in address '%s'", str)= ; >> >> ...but this rejects a trailing comma. Is a trailing comma possible ba= se >> on how QemuOpts work? If so, do you need to handle it here? >=20 > Actually I just wanted to grab characters up until the end of string. > It wasn't clear from the sscanf(3) man page what the best way to do tha= t > was, so I kept the comma which is also used in tcp addresses (because > they support additional comma-separated options). %32s instead of %32[^,] should grab up to all 32 remaining characters in the string; your %n trick then ensures there is no garbage. I guess it's still a question of whether we want to always treat a comma as trailing garbage. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --nrSwUOat93vwA381j3sJaLB8bB3IRq7OK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYBN9qAAoJEKeha0olJ0Nq2F0H/0l6SpOZ1Cr7xtRgV/gKSBqE +sgJHuxn41uHmTc5o2MZ9ZVpCcl3bxDEGfghUnIzLNhruPuOv/xx8HGezQ+yJVHb HWZfYDJFoOfirnDkOPtVzrKrwYoWMO7W1mDgOm+UJKk0gCuuw5HpFyQDUuqLNQoi 1PEZ3o8/xk4yQmlRfQUyfc71yq4AN14+usFpsJInbPGGyppiIZdnydmCfTJFqLPW juOVwgdZOq66XYInfHECEZd+j2ZetBzabB6+qgIBknRLc4Eb9Rzu+1WyLr5aZaTJ yAJBy1QwobqvMGnWRO17YY0c7Zj9T0H20PKSnPxKGNXMzTs8bMOCftqTp4Dv8Ic= =NCZK -----END PGP SIGNATURE----- --nrSwUOat93vwA381j3sJaLB8bB3IRq7OK--