Fix a possible dereference of null pointer when having no tree.

svn path=/trunk/; revision=30174
This commit is contained in:
Stig Bjørlykke 2009-09-27 21:18:18 +00:00
parent 7e458f40e5
commit 8fce84f9e2
2 changed files with 15 additions and 23 deletions

View File

@ -108,18 +108,14 @@ dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
/* do we have spdu type from the session dissector? */
if( !session ){
if(tree){
proto_tree_add_text(tree, tvb, 0, -1,
"Internal error:can't get spdu type from session dissector.");
return;
}
proto_tree_add_text(tree, tvb, 0, -1,
"Internal error:can't get spdu type from session dissector.");
return;
} else {
if(session->spdu_type == 0 ) {
if(tree){
proto_tree_add_text(tree, tvb, 0, -1,
"Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
return;
}
proto_tree_add_text(tree, tvb, 0, -1,
"Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
return;
}
}

View File

@ -4400,18 +4400,14 @@ dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
/* do we have spdu type from the session dissector? */
if( !session ){
if(tree){
proto_tree_add_text(tree, tvb, 0, -1,
"Internal error:can't get spdu type from session dissector.");
return;
}
proto_tree_add_text(tree, tvb, 0, -1,
"Internal error:can't get spdu type from session dissector.");
return;
} else {
if(session->spdu_type == 0 ) {
if(tree){
proto_tree_add_text(tree, tvb, 0, -1,
"Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
return;
}
proto_tree_add_text(tree, tvb, 0, -1,
"Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
return;
}
}
@ -5584,7 +5580,7 @@ void proto_register_cmip(void) {
NULL, HFILL }},
/*--- End of included file: packet-cmip-hfarr.c ---*/
#line 193 "packet-cmip-template.c"
#line 187 "packet-cmip-template.c"
};
/* List of subtrees */
@ -5716,7 +5712,7 @@ void proto_register_cmip(void) {
&ett_cmip_T_modificationList_item,
/*--- End of included file: packet-cmip-ettarr.c ---*/
#line 199 "packet-cmip-template.c"
#line 193 "packet-cmip-template.c"
};
/* Register protocol */
@ -5801,7 +5797,7 @@ void proto_register_cmip(void) {
/*--- End of included file: packet-cmip-dis-tab.c ---*/
#line 208 "packet-cmip-template.c"
#line 202 "packet-cmip-template.c"
oid_add_from_string("discriminatorId(1)","2.9.3.2.7.1");
}