r11124 - libprelude/trunk/src

[email protected]
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
Author: yoann
Date: 2009-04-07 10:10:28 +0200 (Tue, 07 Apr 2009)
New Revision: 11124

Modified:
   libprelude/trunk/src/idmef-additional-data.c
Log:
Fix off by one when checking the type array size. Thanks Steve Grubb <[email protected]>
for reporting this issue.

Modified: libprelude/trunk/src/idmef-additional-data.c
===================================================================
--- libprelude/trunk/src/idmef-additional-data.c	2009-04-07 07:51:35 UTC (rev 11123)
+++ libprelude/trunk/src/idmef-additional-data.c	2009-04-07 08:10:28 UTC (rev 11124)
@@ -179,7 +179,7 @@
 
 static int check_type(idmef_additional_data_type_t type, const unsigned char *buf, size_t len)
 {
-        if ( type < 0 || type > sizeof(idmef_additional_data_type_table) / sizeof(idmef_additional_data_type_table[0]) )
+        if ( type < 0 || type >= sizeof(idmef_additional_data_type_table) / sizeof(*idmef_additional_data_type_table) )
                 return -1;
 
         if ( idmef_additional_data_type_table[type].len != 0 &&
@@ -199,7 +199,7 @@
 
 static idmef_data_type_t idmef_additional_data_type_to_data_type(idmef_additional_data_type_t type)
 {
-        if ( type < 0 || type > sizeof(idmef_additional_data_type_table) / sizeof(idmef_additional_data_type_table[0]) )
+        if ( type < 0 || type >= sizeof(idmef_additional_data_type_table) / sizeof(*idmef_additional_data_type_table) )
                 return IDMEF_DATA_TYPE_UNKNOWN;
 
         return idmef_additional_data_type_table[type].d_type;

_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.