diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /netwerk/base/mozurl/src/lib.rs | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/base/mozurl/src/lib.rs')
-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; } |