[uri] Ensure "##params=" separator is correct

Signed-off-by: Christian Nilsson <nikize@gmail.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Christian Nilsson
2026-02-03 18:59:01 +00:00
committed by Michael Brown
parent 59c67e1110
commit 30d162ddd1
2 changed files with 16 additions and 1 deletions
+2 -1
View File
@@ -321,7 +321,8 @@ struct uri * parse_uri ( const char *uri_string ) {
if ( ( tmp = strstr ( raw, "##params" ) ) ) {
*tmp = '\0';
tmp += 8 /* "##params" */;
params = find_parameters ( *tmp ? ( tmp + 1 ) : NULL );
params = find_parameters ( ( *tmp == '=' ) ?
( tmp + 1 ) : NULL );
if ( params ) {
uri->params = claim_parameters ( params );
} else {
+14
View File
@@ -967,6 +967,19 @@ static struct uri_params_test uri_named_params = {
uri_named_params_list,
};
/** Invalid named form parameter URI test */
static struct uri_params_test uri_invalid_named_params = {
"http://boot.ipxe.org/register##paramsXfoo",
{
.scheme = "http",
.host = "boot.ipxe.org",
.path = "/register",
.epath = "/register",
},
NULL,
uri_named_params_list,
};
/**
* Perform URI self-test
*
@@ -1026,6 +1039,7 @@ static void uri_test_exec ( void ) {
/* Request parameter URI tests */
uri_params_ok ( &uri_params );
uri_params_ok ( &uri_named_params );
uri_params_ok ( &uri_invalid_named_params );
}
/** URI self-test */