diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /netwerk/base/mozurl | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/base/mozurl')
-rw-r--r-- | netwerk/base/mozurl/src/lib.rs | 10 |
1 files changed, 9 insertions, 1 deletions
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; } |