Commit 8492df9f authored by Philip Withnall's avatar Philip Withnall

gdbusaddress: Validate the noncefile attribute of nonce-tcp addresses

Doing this mostly to fix a compiler warning about tautological
assignments on Android.

See the D-Bus specification:
https://dbus.freedesktop.org/doc/dbus-specification.html#transports-nonce-tcp-socketsSigned-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
parent e9900384
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment