diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c index 3b0f369d8..6958d7cc6 100644 --- a/gio/gdbusaddress.c +++ b/gio/gdbusaddress.c @@ -265,9 +265,17 @@ is_valid_nonce_tcp (const gchar *address_entry, /* TODO: validate host */ } - nonce_file = nonce_file; /* To avoid -Wunused-but-set-variable */ + if (nonce_file != NULL && *nonce_file == '\0') + { + g_set_error (error, + G_IO_ERROR, + G_IO_ERROR_INVALID_ARGUMENT, + _("Error in address “%s” — the “%s” attribute is malformed"), + address_entry, "noncefile"); + goto out; + } - ret= TRUE; + ret = TRUE; out: g_list_free (keys); diff --git a/gio/tests/gdbus-addresses.c b/gio/tests/gdbus-addresses.c index 173383d83..26c21ee24 100644 --- a/gio/tests/gdbus-addresses.c +++ b/gio/tests/gdbus-addresses.c @@ -146,6 +146,7 @@ test_nonce_tcp_address (void) assert_not_supported_address ("nonce-tcp:host=localhost,port=420000"); assert_not_supported_address ("nonce-tcp:host=localhost,port=42x"); assert_not_supported_address ("nonce-tcp:host=localhost,port="); + assert_not_supported_address ("nonce-tcp:host=localhost,port=42,noncefile="); } static void