[Spice-devel] [PATCH spice-gtk] Fix parsing URI query

Marc-André Lureau mlureau at redhat.com
Wed May 2 05:31:32 PDT 2012



----- 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.


More information about the Spice-devel mailing list