]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[uri] Ensure "##params=" separator is correct 448/head
authorChristian Nilsson <nikize@gmail.com>
Tue, 3 Feb 2026 18:59:01 +0000 (18:59 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 3 Feb 2026 19:21:12 +0000 (19:21 +0000)
Signed-off-by: Christian Nilsson <nikize@gmail.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/uri.c
src/tests/uri_test.c

index 9da5e298b55c2d24661118aabbfb9325bcb5f504..ea0f2bc45b6decd819d2af043f2f828891b5b675 100644 (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 {
index 7ce87a20813ca2b706a855770aa0133f0faa5672..fa46e22f2de5a99e7ce53cc91d43b3e59d0a051c 100644 (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 */