[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 3/4] sockets: add AF_VSOCK support
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v2 3/4] sockets: add AF_VSOCK support |
Date: |
Mon, 6 Nov 2017 17:12:24 +0000 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Sun, Nov 05, 2017 at 07:59:59PM +0100, Kashyap Chamarthy wrote:
> [Reviving a more than 1-year old thread. I randomly noticed this (refer
> below) while browsing through AF_VSOCK changes in my 'qemu-devel'
> maildir.]
>
> On Tue, Oct 18, 2016 at 11:21:23AM +0100, Stefan Hajnoczi wrote:
> > On Mon, Oct 17, 2016 at 09:25:46AM -0500, Eric Blake wrote:
> > > On 10/16/2016 08:35 AM, Stefan Hajnoczi wrote:
> > >
> > > >>> +
> > > >>> + if (sscanf(str, "%32[^:]:%32[^,]%n", cid, port, &n) != 2) {
> > > >>
> > > >> This says stop at the first comma after the colon...
> > > >>
> > > >>> + error_setg(errp, "error parsing address '%s'", str);
> > > >>> + return NULL;
> > > >>> + }
> > > >>> + if (str[n] != '\0') {
> > > >>> + error_setg(errp, "trailing characters in address '%s'", str);
> > > >>
> > > >> ...but this rejects a trailing comma. Is a trailing comma possible
> > > >> base
> > > >> on how QemuOpts work? If so, do you need to handle it here?
> > > >
> > > > 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).
> > >
> > > %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!
>
> The above change didn't take place while merging at that time as part of
> v2.7.0-1720-g6a02c80.
>
> I still see %32[^,] in all the sscanf(3) calls in
> util/util/qemu-sockets.c
>
> Is it still important to change?
Thanks for noticing. I don't think it's necessary to make this change
now.
Stefan
signature.asc
Description: PGP signature