[evolution-ews/gnome-43] Handle negative value for GUri's port
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/gnome-43] Handle negative value for GUri's port
- Date: Thu, 29 Sep 2022 08:32:27 +0000 (UTC)
commit 7141b8e7df49aa74dda4ca26da9644e2afb6f52c
Author: Milan Crha <mcrha redhat com>
Date: Thu Sep 29 10:30:28 2022 +0200
Handle negative value for GUri's port
GUri uses -1 for 'port not set', but the code uses unsigned 16-bit integer,
which makes the -1 an out of bounds value.
src/EWS/addressbook/e-book-backend-ews.c | 2 +-
src/EWS/calendar/e-cal-backend-ews.c | 2 +-
src/EWS/evolution/e-ews-config-lookup.c | 2 +-
src/EWS/registry/e-ews-backend.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/EWS/addressbook/e-book-backend-ews.c b/src/EWS/addressbook/e-book-backend-ews.c
index 03b7804f..d8d4b8dc 100644
--- a/src/EWS/addressbook/e-book-backend-ews.c
+++ b/src/EWS/addressbook/e-book-backend-ews.c
@@ -4546,7 +4546,7 @@ ebb_ews_get_destination_address (EBackend *backend,
uri = g_uri_parse (host_url, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
if (uri) {
*host = g_strdup (g_uri_get_host (uri));
- *port = g_uri_get_port (uri);
+ *port = g_uri_get_port (uri) > 0 ? g_uri_get_port (uri) : 0;
result = *host && **host;
if (!result) {
diff --git a/src/EWS/calendar/e-cal-backend-ews.c b/src/EWS/calendar/e-cal-backend-ews.c
index 5ff9ca95..7159c4ed 100644
--- a/src/EWS/calendar/e-cal-backend-ews.c
+++ b/src/EWS/calendar/e-cal-backend-ews.c
@@ -4613,7 +4613,7 @@ ecb_ews_get_destination_address (EBackend *backend,
uri = g_uri_parse (host_url, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
if (uri) {
*host = g_strdup (g_uri_get_host (uri));
- *port = g_uri_get_port (uri);
+ *port = g_uri_get_port (uri) > 0 ? g_uri_get_port (uri) : 0;
result = *host && **host;
if (!result) {
diff --git a/src/EWS/evolution/e-ews-config-lookup.c b/src/EWS/evolution/e-ews-config-lookup.c
index 7e854af7..a5622742 100644
--- a/src/EWS/evolution/e-ews-config-lookup.c
+++ b/src/EWS/evolution/e-ews-config-lookup.c
@@ -253,7 +253,7 @@ ews_config_lookup_worker_result_from_data (EConfigLookup *config_lookup,
"host", g_uri_get_host (uri));
}
- if (uri && g_uri_get_port (uri)) {
+ if (uri && g_uri_get_port (uri) > 0) {
e_config_lookup_result_simple_add_uint (lookup_result,
E_SOURCE_EXTENSION_AUTHENTICATION,
"port", g_uri_get_port (uri));
diff --git a/src/EWS/registry/e-ews-backend.c b/src/EWS/registry/e-ews-backend.c
index 80289ae2..eb593d1b 100644
--- a/src/EWS/registry/e-ews-backend.c
+++ b/src/EWS/registry/e-ews-backend.c
@@ -1246,7 +1246,7 @@ ews_backend_get_destination_address (EBackend *backend,
uri = g_uri_parse (host_url, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
if (uri) {
*host = g_strdup (g_uri_get_host (uri));
- *port = g_uri_get_port (uri);
+ *port = g_uri_get_port (uri) > 0 ? g_uri_get_port (uri) : 0;
result = *host && **host;
if (!result) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]