mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-07 02:59:39 +02:00
networkaddress: Fix userinfo parsing in uris
The code that is checking the userinfo part was accidentally given a pointer to the end of the userinfo, so it was not checking the right portion of the string at all.
This commit is contained in:
parent
2a1ea40920
commit
5632e9fc9c
@ -475,15 +475,15 @@ _g_uri_parse_authority (const char *uri,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
start += 2;
|
start += 2;
|
||||||
p = strchr (start, '@');
|
|
||||||
|
|
||||||
if (p != NULL)
|
if (strchr (start, '@') != NULL)
|
||||||
{
|
{
|
||||||
/* Decode userinfo:
|
/* Decode userinfo:
|
||||||
* userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
|
* userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
|
||||||
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
||||||
* pct-encoded = "%" HEXDIG HEXDIG
|
* pct-encoded = "%" HEXDIG HEXDIG
|
||||||
*/
|
*/
|
||||||
|
p = start;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
c = *p++;
|
c = *p++;
|
||||||
@ -504,7 +504,7 @@ _g_uri_parse_authority (const char *uri,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* unreserved / sub-delims / : */
|
/* unreserved / sub-delims / : */
|
||||||
if (!(g_ascii_isalnum(c) ||
|
if (!(g_ascii_isalnum (c) ||
|
||||||
strchr (G_URI_OTHER_UNRESERVED, c) ||
|
strchr (G_URI_OTHER_UNRESERVED, c) ||
|
||||||
strchr (G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS, c) ||
|
strchr (G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS, c) ||
|
||||||
c == ':'))
|
c == ':'))
|
||||||
@ -540,7 +540,7 @@ _g_uri_parse_authority (const char *uri,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* unreserved / sub-delims */
|
/* unreserved / sub-delims */
|
||||||
if (!(g_ascii_isalnum(c) ||
|
if (!(g_ascii_isalnum (c) ||
|
||||||
strchr (G_URI_OTHER_UNRESERVED, c) ||
|
strchr (G_URI_OTHER_UNRESERVED, c) ||
|
||||||
strchr (G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS, c) ||
|
strchr (G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS, c) ||
|
||||||
c == ':' ||
|
c == ':' ||
|
||||||
@ -574,7 +574,7 @@ _g_uri_parse_authority (const char *uri,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* unreserved / sub-delims */
|
/* unreserved / sub-delims */
|
||||||
if (!(g_ascii_isalnum(c) ||
|
if (!(g_ascii_isalnum (c) ||
|
||||||
strchr (G_URI_OTHER_UNRESERVED, c) ||
|
strchr (G_URI_OTHER_UNRESERVED, c) ||
|
||||||
strchr (G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS, c)))
|
strchr (G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS, c)))
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user