Trac 97: Fixed seg fault on decode

The packet type is signed and was not bounds-checked for
being negative.
This commit is contained in:
Dan Talayco
2010-06-03 10:13:46 -07:00
parent 204366af96
commit 91ed09bcb2
@@ -1947,7 +1947,7 @@ void proto_register_openflow()
const char* ofp_type_to_string( gint8 type ) {
static char str_unknown[17];
if( type <= OFP_TYPE_MAX_VALUE )
if(( type <= OFP_TYPE_MAX_VALUE ) && (type >= 0))
return names_ofp_type[type].strptr;
else {
snprintf( str_unknown, 17, "Unknown Type %u", type );