[evolution-data-server] Handle negative value for GUri's port
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Handle negative value for GUri's port
- Date: Thu, 29 Sep 2022 08:25:42 +0000 (UTC)
commit efdfee635ed1c2eaa80c80aecf33ed8690b21e42
Author: Milan Crha <mcrha redhat com>
Date: Thu Sep 29 10:22:45 2022 +0200
Handle negative value for GUri's port
GUri uses -1 for 'port not set', but the evolution-data-server code uses
unsigned 16-bit integer, which makes the -1 an out of bounds value.
src/libedataserver/e-source-webdav.c | 4 ++--
src/libedataserverui/e-webdav-discover-widget.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/libedataserver/e-source-webdav.c b/src/libedataserver/e-source-webdav.c
index 8aee999ac..d55361e70 100644
--- a/src/libedataserver/e-source-webdav.c
+++ b/src/libedataserver/e-source-webdav.c
@@ -169,7 +169,7 @@ source_webdav_update_properties_from_uri (ESourceWebdav *webdav_extension)
g_object_set (
extension,
"host", g_uri_get_host (uri),
- "port", g_uri_get_port (uri),
+ "port", g_uri_get_port (uri) > 0 ? g_uri_get_port (uri) : 0,
NULL);
if (g_uri_get_user (uri) && *g_uri_get_user (uri))
@@ -238,7 +238,7 @@ source_webdav_update_uri_from_properties (ESourceWebdav *webdav_extension)
e_source_extension_property_lock (E_SOURCE_EXTENSION (webdav_extension));
if (port == 0)
- port = g_uri_get_port (webdav_extension->priv->uri);
+ port = g_uri_get_port (webdav_extension->priv->uri) > 0 ? g_uri_get_port
(webdav_extension->priv->uri) : 0;
scheme = g_uri_get_scheme (webdav_extension->priv->uri);
diff --git a/src/libedataserverui/e-webdav-discover-widget.c b/src/libedataserverui/e-webdav-discover-widget.c
index 15ea37e48..95315b4a1 100644
--- a/src/libedataserverui/e-webdav-discover-widget.c
+++ b/src/libedataserverui/e-webdav-discover-widget.c
@@ -922,7 +922,7 @@ e_webdav_discover_content_refresh (GtkWidget *content,
e_source_set_display_name (source, display_name);
e_source_webdav_set_uri (webdav_extension, parsed_uri);
e_source_authentication_set_host (auth_extension, g_uri_get_host (parsed_uri));
- e_source_authentication_set_port (auth_extension, g_uri_get_port (parsed_uri));
+ e_source_authentication_set_port (auth_extension, g_uri_get_port (parsed_uri) > 0 ?
g_uri_get_port (parsed_uri) : 0);
e_source_authentication_set_user (auth_extension, g_uri_get_user (parsed_uri));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]