From da4c7e7ed675c3bf405668739c3012d140856109 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:34:42 +0200 Subject: Adding upstream version 126.0. Signed-off-by: Daniel Baumann --- netwerk/base/mozurl/src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'netwerk/base/mozurl') diff --git a/netwerk/base/mozurl/src/lib.rs b/netwerk/base/mozurl/src/lib.rs index 21be5f7e8b..ac33f0f8a8 100644 --- a/netwerk/base/mozurl/src/lib.rs +++ b/netwerk/base/mozurl/src/lib.rs @@ -214,7 +214,10 @@ pub extern "C" fn mozurl_real_port(url: &MozURL) -> i32 { #[no_mangle] pub extern "C" fn mozurl_host_port(url: &MozURL) -> SpecSlice { - (&url[Position::BeforeHost..Position::BeforePath]).into() + if url.port().is_some() { + return (&url[Position::BeforeHost..Position::BeforePath]).into(); + } + url.host_str().unwrap_or("").into() } #[no_mangle] @@ -436,6 +439,11 @@ pub extern "C" fn mozurl_set_hostname(url: &mut MozURL, host: &nsACString) -> ns #[no_mangle] pub extern "C" fn mozurl_set_port_no(url: &mut MozURL, new_port: i32) -> nsresult { debug_assert_mut!(url); + + if new_port > u16::MAX as i32 { + return NS_ERROR_UNEXPECTED; + } + if url.cannot_be_a_base() { return NS_ERROR_MALFORMED_URI; } -- cgit v1.2.3