Commit 69b876b3 authored by Olivier Crête's avatar Olivier Crête
Browse files

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
parent a3abccdd
......@@ -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 "
......
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