From 3b1ce252336617fa29aa73eb6ef7f791a6e2952e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 28 Mar 2011 18:52:02 +0100 Subject: [PATCH 24/25] Don't allow proxy timeouts to be set negative, except for -1 libdbus checks this as a precondition, but to avoid astonishing error behaviour (interpreted as OOM), so should we. --- dbus/dbus-gproxy.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/dbus/dbus-gproxy.c b/dbus/dbus-gproxy.c index 7ef76d3..578aff5 100644 --- a/dbus/dbus-gproxy.c +++ b/dbus/dbus-gproxy.c @@ -2512,6 +2512,7 @@ dbus_g_proxy_begin_call_with_timeout (DBusGProxy *proxy, g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), NULL); g_return_val_if_fail (!DBUS_G_PROXY_DESTROYED (proxy), NULL); + g_return_val_if_fail (timeout >= 0 || timeout == -1, NULL); va_start (args, first_arg_type); @@ -2659,6 +2660,7 @@ dbus_g_proxy_call_with_timeout (DBusGProxy *proxy, g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), FALSE); g_return_val_if_fail (!DBUS_G_PROXY_DESTROYED (proxy), FALSE); + g_return_val_if_fail (timeout >= 0 || timeout == -1, FALSE); va_start (args, first_arg_type); @@ -3003,6 +3005,7 @@ dbus_g_proxy_set_default_timeout (DBusGProxy *proxy, g_return_if_fail (DBUS_IS_G_PROXY (proxy)); g_return_if_fail (!DBUS_G_PROXY_DESTROYED (proxy)); + g_return_if_fail (timeout >= 0 || timeout == -1); priv = DBUS_G_PROXY_GET_PRIVATE(proxy); priv->default_timeout = timeout; -- 1.7.4.1