[Spice-devel] [PATCH spice-gtk v4 5/8] spice-uri: Do not allow empty port string
Victor Toso
lists at victortoso.com
Tue May 31 08:04:15 UTC 2016
Hi,
On Mon, May 30, 2016 at 05:46:47PM +0200, Pavel Grunt wrote:
> Related: rhbz#1335239
Acked-by: Victor Toso <victortoso at redhat.com>
> ---
> src/spice-uri.c | 3 +++
> tests/test-spice-uri.c | 1 +
> 2 files changed, 4 insertions(+)
>
> diff --git a/src/spice-uri.c b/src/spice-uri.c
> index 9f793de..ea25aaa 100644
> --- a/src/spice-uri.c
> +++ b/src/spice-uri.c
> @@ -176,6 +176,9 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error)
> g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> "Invalid uri port: %s", uri_port);
> goto end;
> + } else if (endptr == uri_port) {
> + g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, "Missing uri port");
> + goto end;
> }
> spice_uri_set_port(self, port);
> }
> diff --git a/tests/test-spice-uri.c b/tests/test-spice-uri.c
> index e177723..d1dcc59 100644
> --- a/tests/test-spice-uri.c
> +++ b/tests/test-spice-uri.c
> @@ -36,6 +36,7 @@ static void test_spice_uri_ipv4_bad(void)
> {"http://", "http", NULL, 3128, NULL, NULL, "Invalid hostname in uri address"},
> {"http://127.0.0.1:port", "http", "127.0.0.1", 3128, NULL, NULL,
> "Invalid uri port: port"},
> + {"http://127.0.0.1:", "http", "127.0.0.1", 3128, NULL, NULL, "Missing uri port"},
> };
>
> guint i;
> --
> 2.8.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list