Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at packet-cops.c:1516

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

dissect_cops_pr_object_data

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-cops.c)expand/collapse
Show more  
 1381  static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 offset, proto_tree *tree,
 1382                                                                             guint8 s_num, guint8 s_type, int len,
 1383                                                                             oid_info_t** oid_info_p, guint32** pprid_subids, guint* pprid_subids_len) {
 1384    proto_item *ti;
 1385    proto_tree *asn_tree, *gperror_tree, *cperror_tree;
 1386    guint16 gperror=0, gperror_sub=0, cperror=0, cperror_sub=0;
 1387    asn1_ctx_t actx;
 1388   
 1389    memset(&actx,0,sizeof(actx));
 1390    actx.pinfo = pinfo;
 1391   
 1392    switch (s_num){
 1393            case COPS_OBJ_PPRID: {
 1394                    tvbuff_t* oid_tvb = NULL;
 1395   
 1396                    if (s_type != 1) /* Not Prefix Provisioning Instance Identifier (PPRID) */
 1397                            break;
 1398                    /* Never tested this branch */
 1399                    ti = proto_tree_add_text(tree, tvb, offset, len, "Contents:");
 1400                    asn_tree = proto_item_add_subtree(ti, ett_cops_asn1);
 1401   
 1402                    offset = dissect_ber_object_identifier(FALSE, &actx, asn_tree, tvb, offset, hf_cops_pprid_oid, &oid_tvb);
 1403
1451
Show [ Lines 1403 to 1451 omitted. ]
 1452                             what's bellow works in most cases but is not complete.
 1453                     */
 1454                    if (left <= 1 && oid_info->kind == OID_KIND_ROW) {
 1455                            *oid_info_p = oid_info;
 1456                    } else {
 1457                            *oid_info_p = NULL;
 1458                    }
 1459   
 1460                    break;
 1461            }
 1462            case COPS_OBJ_EPD: {
 1463                    oid_info_t* oid_info;
 1464                    guint end_offset = offset + len;
 1465   
 1466                    if (s_type != 1) break;/* Not Encoded Provisioning Instance Data (EPD) */
 1467   
 1468                    ti = proto_tree_add_text(tree, tvb, offset, len, "Contents:");
 1469                    asn_tree = proto_item_add_subtree(ti, ett_cops_asn1);
 1470   
 1471                    /*
 1472                     * XXX: LAZYNESS WARNING:
 1473                     * We are assuming that for the first element in the sequence 
 1474                     * that describes an entry subid==1, and, that the subsequent elements
 1475                     * use ++subid; This is true for all IETF's PIBs (and good sense
 1476                     * indicates it should be this way) but AFAIK there's nothing in
 1477                     * SMIv2 that imposes this restriction.  -- a lazy lego 
 1478                     */
 1479   
 1480                    if(*oid_info_p) {
 1481                            if ((*oid_info_p)->kind == OID_KIND_ROW) {
 1482                                    oid_info = emem_tree_lookup32((*oid_info_p)->children,1);
 1483                            } else {
 1484                                    oid_info = NULL;
 1485                            }
 1486                    } else {
 1487                            oid_info = NULL;
 1488                    }
 1489   
 1490   
 1491                    while(offset < end_offset) {
 1492                            gint8 ber_class;
 1493                            gboolean ber_pc;
 1494                            gint32 ber_tag;
 1495                            guint32 ber_length;
 1496                            gboolean ber_ind;
 1497   
 1498                            offset = get_ber_identifier(tvb, offset, &ber_class, &ber_pc, &ber_tag);
 1499                            offset = get_ber_length(tvb, offset, &ber_length, &ber_ind);
 1500   
 1501                            if (oid_info) {
 1502                                    /*
 1503                                     * XXX: LAZYNESS WARNING:
 1504                                     * We are assuming that the value of the sequenced item is of
 1505                                     * the right class, the right type and the right legth.
 1506                                     * We should check that to avoid throwing a Malformed packet and 
 1507                                     * keep dissecting.
 1508                                     * We should verify the class and the tag match what we expect as well,
 1509                                     * but COPS and SNMP use different tags (&#@$!) so the typedata in oid_info_t 
 1510                                     * does not work here.
 1511                                     * -- a lazy lego 
 1512                                     */
 1513   
 1514                                    proto_tree_add_item(asn_tree,oid_info->value_hfid,tvb,offset,ber_length,FALSE);
 1515   
 1516                                    oid_info = emem_tree_lookup32((*oid_info_p)->children,oid_info->subid+1);
 1517                            } else {
 1518                                    int hfid = cops_tag_cls2syntax( ber_tag, ber_class );
 1519                                    proto_tree_add_item(asn_tree,hfid,tvb,offset,ber_length,FALSE);
 1520                            }
 1521   
 1522                            offset += ber_length;
Show more  




Change Warning 1977.32748 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: