[Pkg-telepathy-commits] [libnice] 108/265: agent: Make sure there is no integer overflow if the timeout is now

Simon McVittie smcv at debian.org
Wed May 14 12:04:58 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository libnice.

commit 69b876b3ba3fedc4c79a3e03ed39892713e97076
Author: Olivier Crête <olivier.crete at collabora.com>
Date:   Fri Jan 24 02:01:29 2014 -0500

    agent: Make sure there is no integer overflow if the timeout is now
    
    Make sure that if the timeout is now, no negative number is passed as
    an unsigned
---
 agent/agent.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/agent/agent.c b/agent/agent.c
index b925505..771a568 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -1217,10 +1217,15 @@ adjust_tcp_clock (NiceAgent *agent, Stream *stream, Component *component)
           component->tcp_clock = NULL;
 #endif
         }
-        if (!component->tcp_clock)
-          component->tcp_clock = agent_timeout_add_with_context (agent,
-              timeout - (g_get_monotonic_time () / 1000),
+        if (!component->tcp_clock) {
+          long interval = timeout - (g_get_monotonic_time () / 1000);
+
+          /* Prevent integer overflows */
+          if (interval < 0 || interval > G_MAXINT)
+            interval = 0;
+          component->tcp_clock = agent_timeout_add_with_context (agent, interval,
               notify_pseudo_tcp_socket_clock, component);
+        }
       }
     } else {
       nice_debug ("Agent %p: component %d pseudo-TCP socket should be "

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git



More information about the Pkg-telepathy-commits mailing list