[Nice] [nice/master] Check that the buffers are our fake data before counting them (so that refused stun packages dont trigger it)
Olivier Crête
olivier.crete at collabora.co.uk
Wed Nov 5 14:01:41 PST 2008
---
agent/test-fallback.c | 8 ++++++++
agent/test-fullmode.c | 8 ++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/agent/test-fallback.c b/agent/test-fallback.c
index 13cbb90..64cf4d6 100644
--- a/agent/test-fallback.c
+++ b/agent/test-fallback.c
@@ -86,6 +86,14 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id,
/* XXX: dear compiler, these are for you: */
(void)agent; (void)stream_id; (void)component_id; (void)buf;
+ /*
+ * Lets ignore stun packets that got through
+ */
+ if (len != 16)
+ return;
+ if (strncmp ("1234567812345678", buf, 16))
+ return;
+
if ((intptr_t)user_data == 2) {
global_ragent_read += len;
diff --git a/agent/test-fullmode.c b/agent/test-fullmode.c
index ba3af6f..8a6f644 100644
--- a/agent/test-fullmode.c
+++ b/agent/test-fullmode.c
@@ -84,6 +84,14 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id,
/* XXX: dear compiler, these are for you: */
(void)agent; (void)stream_id; (void)component_id; (void)buf;
+ /*
+ * Lets ignore stun packets that got through
+ */
+ if (len < 8)
+ return;
+ if (strncmp ("12345678", buf, 8))
+ return;
+
if ((intptr_t)user_data == 2) {
global_ragent_read = len;
g_main_loop_quit (global_mainloop);
--
1.5.6.5
More information about the Nice
mailing list