[Spice-devel] [PATCH spice-gtk] Fix parsing URI query
Daniel P. Berrange
berrange at redhat.com
Wed May 2 05:36:15 PDT 2012
On Wed, May 02, 2012 at 08:31:32AM -0400, Marc-André Lureau wrote:
>
>
> ----- Mensaje original -----
> > > if (path) {
> > > size_t prefix = strcspn(path, URI_QUERY_START);
> > > - if (len)
> > > - query = path + prefix;
> > > + query = path + prefix;
> > > } else {
> > > size_t prefix = strcspn(authority, URI_QUERY_START);
> > > - if (len)
> > > - query = authority + prefix;
> > > + query = authority + prefix;
> >
> > If there is no query character at all (ie no '?') then 'query' will
> > now get initialized to the same as 'path' or 'authority' which is
> > wrong. These 'if (len)' should have actually been 'if (prefix)',
> > so that we leave 'query' as NULL if we don't match.
>
> It is initialized to the end of uri string, so as an empty string.
> That is then checked and skipped correctly.
Oh whoops, I'm mixing behaviour of strcspn vs strspn.
ACK
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the Spice-devel
mailing list