Copy the rev 34143 changes to packet-snmp.c over to the asn1 source.

hf_snmp_engineid_enterprise is now a BASE_EXT_STRING, not BASE_RANGE_STRING.  This fixes
the fuzz failure in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5233 

svn path=/trunk/; revision=34151
This commit is contained in:
Jeff Morriss 2010-09-17 14:03:05 +00:00
parent 20cc0d7ce9
commit 9ac49c557d
2 changed files with 25 additions and 25 deletions

View File

@ -757,13 +757,13 @@ indexing_done:
gint64 val=0;
unsigned offset = value_offset;
unsigned i;
max_len = 5; min_len = 1;
if (value_len > (guint)max_len && value_len < (guint)min_len) {
format_error = BER_WRONG_LENGTH;
break;
}
if(value_len > 0) {
/* extend sign bit */
if(tvb_get_guint8(tvb, offset)&0x80){
@ -828,7 +828,7 @@ indexing_done:
pi_value = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,FALSE);
expert_add_info_format(actx->pinfo, pi_value, PI_UNDECODED, PI_NOTE, "Unresolved value, Missing MIB");
}
already_added:
oid_info_is_ok = FALSE;
}
@ -1900,7 +1900,7 @@ static void* snmp_users_copy_cb(void* dest, const void* orig, unsigned len _U_)
d->user.privKey.data = o->user.privKey.data ? g_memdup(o->user.privKey.data,o->user.privKey.len) : NULL;
d->user.privKey.len = o->user.privKey.len;
return d;
}
@ -1918,7 +1918,7 @@ static void snmp_users_update_cb(void* p _U_, const char** err) {
snmp_ue_assoc_t* ue = p;
GString* es = g_string_new("");
unsigned i;
*err = NULL;
if (num_ueas == 0)
@ -1930,18 +1930,18 @@ static void snmp_users_update_cb(void* p _U_, const char** err) {
for (i=0; i<num_ueas-1; i++) {
snmp_ue_assoc_t* u = &(ueas[i]);
if ( u->user.userName.len == ue->user.userName.len
&& u->engine.len == ue->engine.len ) {
if (u->engine.len > 0 && memcmp( u->engine.data, ue->engine.data, u->engine.len ) == 0) {
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
/* XXX: make a string for the engineId */
g_string_append_printf(es,"duplicate key (userName='%s')\n",ue->user.userName.data);
}
}
if (u->engine.len == 0) {
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
g_string_append_printf(es,"duplicate key (userName='%s' engineId=NONE)\n",ue->user.userName.data);
@ -1949,12 +1949,12 @@ static void snmp_users_update_cb(void* p _U_, const char** err) {
}
}
}
if (es->len) {
g_string_truncate(es,es->len-2);
*err = ep_strdup(es->str);
}
g_string_free(es,TRUE);
return;
@ -2011,8 +2011,8 @@ void proto_register_snmp(void) {
"Engine ID Conformance", "snmp.engineid.conform", FT_BOOLEAN, 8,
TFS(&tfs_snmp_engineid_conform), F_SNMP_ENGINEID_CONFORM, "Engine ID RFC3411 Conformance", HFILL }},
{ &hf_snmp_engineid_enterprise, {
"Engine Enterprise ID", "snmp.engineid.enterprise", FT_UINT32, BASE_DEC,
VALS(sminmpec_values), 0, NULL, HFILL }},
"Engine Enterprise ID", "snmp.engineid.enterprise", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
&sminmpec_values_ext, 0, NULL, HFILL }},
{ &hf_snmp_engineid_format, {
"Engine ID Format", "snmp.engineid.format", FT_UINT8, BASE_DEC,
VALS(snmp_engineid_format_vals), 0, NULL, HFILL }},

View File

@ -859,13 +859,13 @@ indexing_done:
gint64 val=0;
unsigned offset = value_offset;
unsigned i;
max_len = 5; min_len = 1;
if (value_len > (guint)max_len && value_len < (guint)min_len) {
format_error = BER_WRONG_LENGTH;
break;
}
if(value_len > 0) {
/* extend sign bit */
if(tvb_get_guint8(tvb, offset)&0x80){
@ -930,7 +930,7 @@ indexing_done:
pi_value = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,FALSE);
expert_add_info_format(actx->pinfo, pi_value, PI_UNDECODED, PI_NOTE, "Unresolved value, Missing MIB");
}
already_added:
oid_info_is_ok = FALSE;
}
@ -3124,7 +3124,7 @@ static void* snmp_users_copy_cb(void* dest, const void* orig, unsigned len _U_)
d->user.privKey.data = o->user.privKey.data ? g_memdup(o->user.privKey.data,o->user.privKey.len) : NULL;
d->user.privKey.len = o->user.privKey.len;
return d;
}
@ -3142,7 +3142,7 @@ static void snmp_users_update_cb(void* p _U_, const char** err) {
snmp_ue_assoc_t* ue = p;
GString* es = g_string_new("");
unsigned i;
*err = NULL;
if (num_ueas == 0)
@ -3154,18 +3154,18 @@ static void snmp_users_update_cb(void* p _U_, const char** err) {
for (i=0; i<num_ueas-1; i++) {
snmp_ue_assoc_t* u = &(ueas[i]);
if ( u->user.userName.len == ue->user.userName.len
&& u->engine.len == ue->engine.len ) {
if (u->engine.len > 0 && memcmp( u->engine.data, ue->engine.data, u->engine.len ) == 0) {
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
/* XXX: make a string for the engineId */
g_string_append_printf(es,"duplicate key (userName='%s')\n",ue->user.userName.data);
}
}
if (u->engine.len == 0) {
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
g_string_append_printf(es,"duplicate key (userName='%s' engineId=NONE)\n",ue->user.userName.data);
@ -3173,12 +3173,12 @@ static void snmp_users_update_cb(void* p _U_, const char** err) {
}
}
}
if (es->len) {
g_string_truncate(es,es->len-2);
*err = ep_strdup(es->str);
}
g_string_free(es,TRUE);
return;
@ -3235,7 +3235,7 @@ void proto_register_snmp(void) {
"Engine ID Conformance", "snmp.engineid.conform", FT_BOOLEAN, 8,
TFS(&tfs_snmp_engineid_conform), F_SNMP_ENGINEID_CONFORM, "Engine ID RFC3411 Conformance", HFILL }},
{ &hf_snmp_engineid_enterprise, {
"Engine Enterprise ID", "snmp.engineid.enterprise", FT_UINT32, BASE_DEC|BASE_RANGE_STRING,
"Engine Enterprise ID", "snmp.engineid.enterprise", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
&sminmpec_values_ext, 0, NULL, HFILL }},
{ &hf_snmp_engineid_format, {
"Engine ID Format", "snmp.engineid.format", FT_UINT8, BASE_DEC,