diff stream/realrtsp/asmrp.c @ 21783:4511c04bc4a0

Fix potential buffer overflow in asm rules matching code
author rtogni
date Sun, 31 Dec 2006 13:27:53 +0000
parents 118af5ff4b1d
children 899739212237
line wrap: on
line diff
--- a/stream/realrtsp/asmrp.c	Sun Dec 31 11:09:53 2006 +0000
+++ b/stream/realrtsp/asmrp.c	Sun Dec 31 13:27:53 2006 +0000
@@ -41,6 +41,7 @@
 #include <stdio.h>
 #include <string.h>
 #include "mp_msg.h"
+#include "asmrp.h"
 
 /*
 #define LOG
@@ -646,8 +647,11 @@
 #ifdef LOG
       printf ("rule #%d is true\n", rule_num);
 #endif
-      matches[num_matches] = rule_num;
-      num_matches++;
+      if(num_matches < MAX_RULEMATCHES - 1)
+        matches[num_matches++] = rule_num;
+      else
+        mp_msg(MSGT_STREAM, MSGL_ERR,
+	  "Ignoring matched asm rule %d, too many matched rules.\n", rule_num);
     }
 
     rule_num++;