[telepathy-gabble/master] Validate that the stream state being set is within the allowed range.

Mike Ruprecht mike.ruprecht at collabora.co.uk
Tue Dec 29 05:35:04 PST 2009


---
 src/call-stream-endpoint.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/call-stream-endpoint.c b/src/call-stream-endpoint.c
index 59b95a1..d6fe6c7 100644
--- a/src/call-stream-endpoint.c
+++ b/src/call-stream-endpoint.c
@@ -330,6 +330,15 @@ call_stream_endpoint_set_stream_state (GabbleSvcCallStreamEndpoint *iface,
 {
   GabbleCallStreamEndpoint *self = GABBLE_CALL_STREAM_ENDPOINT (iface);
 
+  if (state >= NUM_TP_MEDIA_STREAM_STATES)
+    {
+      GError *error;
+      g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+          "Stream state is out of the valid range.");
+      dbus_g_method_return_error (context, error);
+      g_error_free (error);
+    }
+
   self->priv->stream_state = state;
 
   gabble_jingle_content_set_transport_state (self->priv->content,
-- 
1.5.6.5




More information about the telepathy-commits mailing list