From ff44ab74a272e62923173493993f4702c8e0c66a Mon Sep 17 00:00:00 2001 From: Christian Nilsson Date: Sat, 21 Aug 2021 23:49:37 +0200 Subject: [PATCH] [uri] names of params must be separated with '=' Signed-off-by: Christian Nilsson --- src/core/uri.c | 2 +- src/tests/uri_test.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/uri.c b/src/core/uri.c index e9e512ab4..7fdd52b70 100644 --- a/src/core/uri.c +++ b/src/core/uri.c @@ -317,7 +317,7 @@ 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 { diff --git a/src/tests/uri_test.c b/src/tests/uri_test.c index 92c2f9037..06343068b 100644 --- a/src/tests/uri_test.c +++ b/src/tests/uri_test.c @@ -907,6 +907,18 @@ 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", + }, + NULL, + uri_named_params_list, +}; + /** * Perform URI self-test * @@ -962,6 +974,7 @@ static void uri_test_exec ( void ) { /* Form parameter URI tests */ uri_params_ok ( &uri_params ); uri_params_ok ( &uri_named_params ); + uri_params_ok ( &uri_invalid_named_params ); } /** URI self-test */