From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwRWV-0000dW-HF for qemu-devel@nongnu.org; Tue, 18 Oct 2016 06:21:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwRWQ-0002Nm-Jk for qemu-devel@nongnu.org; Tue, 18 Oct 2016 06:21:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53792) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwRWQ-0002Ml-Dl for qemu-devel@nongnu.org; Tue, 18 Oct 2016 06:21:26 -0400 Date: Tue, 18 Oct 2016 11:21:23 +0100 From: Stefan Hajnoczi Message-ID: <20161018102123.GF19457@stefanha-x1.localdomain> References: <1476435656-3100-1-git-send-email-stefanha@redhat.com> <1476435656-3100-4-git-send-email-stefanha@redhat.com> <20161016133526.GA13844@stefanha-x1.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="924gEkU1VlJlwnwX" Content-Disposition: inline In-Reply-To: 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: Eric Blake Cc: qemu-devel@nongnu.org, Michael Roth --924gEkU1VlJlwnwX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 17, 2016 at 09:25:46AM -0500, Eric Blake wrote: > On 10/16/2016 08:35 AM, Stefan Hajnoczi wrote: >=20 > >>> + > >>> + 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 that > > was, so I kept the comma which is also used in tcp addresses (because > > they support additional comma-separated options). >=20 > %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. No comma options are currently accepted. Treating comma as garbage seems okay. Mike: Please change %32[^,] to %32s when merging. Thanks! Stefan --924gEkU1VlJlwnwX Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJYBfejAAoJEJykq7OBq3PIk+sH/ikyXEY0aufvbwb/UOng6A/7 K9b9/cKKD4xE9BeheVwfCNr9cLKn977veYZ1Vq3YFC7nIBHz5Gxuc0T442IY4tHy 63BFFyYOuV074WymUIwc74K+hCHgnX89GJdCDkfunECMXTbT3OJhOr0CBfKYLhNE /XnFyVzI1wPYiBa1zPDJthBXoSCBAMYtycc0s7vlwxrJffq9geNeZpOhj7Tp63WV 8MYBSxIS6sb5eqnOdqqqjIadUft4uyt41II9IQAqTHuwBzxhT9EdA8EEwWzT7EuC doji6VdJSvt7E2AyNvdVS2O9tU1A437/1tmLt2pwZZCP+Ph+Jv32IfewoEY13j4= =m0zY -----END PGP SIGNATURE----- --924gEkU1VlJlwnwX--