Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Call  at packet-asn1.c:3422

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

build_pdu_tree

(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/asn1/packet-asn1.c)expand/collapse
Show more  
 3400  build_pdu_tree(const char *pduname)
 3401  {
 3402          SearchDef sd;
 3403          guint pdudef, i, tcount;
 3404          guint sav_len;
 3405          PDUinfo *info;
 3406          char text[400];
 3407          guint j, k;
 3408          gint defid;
 3409          PDUinfo *p, *q;
 3410          TypeRef *tr;
 3411   
 3412          if (asn1_verbose) g_message("build msg tree from '%s' for '%s'", current_asn1, pduname);
 3413   
 3414          if (!data_nodes) {
 3415                  if (asn1_verbose) g_message("no data nodes");
 3416                  return FALSE;
 3417          }
 3418          sd.key = pduname;
 3419          sd.here = 0;
 3420          g_node_traverse(data_nodes, G_PRE_ORDER, G_TRAVERSE_ALL, -1, is_typedef, (gpointer)&sd);
 3421          if (sd.here) {
 3422                  pdudef = ((TBLTypeDef *)(sd.here->data))->typeDefId;
 3423                  if (asn1_verbose) g_message("%s found, %p, typedef %d", sd.key, sd.here, pdudef);
 3424          } else {
 3425                  if (asn1_verbose) g_message("%s not found, ignored", sd.key);
 3426                  return FALSE;
 3427          }
 3428   
 3429          /* If there's an existing PDU tree, free it */
 3430          if (PDUtree) {
 3431                  g_node_traverse(PDUtree, G_POST_ORDER, G_TRAVERSE_ALL, -1,
 3432                      free_node_data, NULL);
 3433                  g_node_destroy(PDUtree);
 3434          }
 3435   
 3436          /* initialize the PDU tree, hand craft the root entry */
 3437   
 3438          info = g_malloc0(sizeof(PDUinfo));
 3439          info->name = pduname;
 3440          info->typename = pduname;
 3441          info->type = TBL_SEQUENCEOF;
 3442          info->fullname = g_strdup_printf("%s.%s", pabbrev, pduname);
 3443          info->flags = PDUinfo_initflags = 0;
 3444          info->value_id = -1;
 3445          info->type_id = -1;
 3446          info->basetype = -1;
 3447          info->mytype = pdudef;
 3448   
 3449          info->value_hf.p_id = &(info->value_id);
 3450          info->value_hf.hfinfo.name = info->fullname;
 3451          info->value_hf.hfinfo.abbrev = info->fullname;
 3452          info->value_hf.hfinfo.type = tbl_types_wireshark[info->type];
 3453          info->value_hf.hfinfo.display = BASE_DEC;
 3454          info->value_hf.hfinfo.blurb = info->fullname;
 3455   
 3456          anonCount = 0; /* anonymous types counter */
 3457   
 3458          PDUtree = g_node_new(info);
 3459          pabbrev_pdu_len = g_sprintf(fieldname, "%s.%s.", pabbrev, pduname);
 3460          sav_len = pabbrev_pdu_len;
 3461   
 3462          /* Now build the tree for this top level PDU */
 3463          if (asn1_verbose)
 3464                  g_message("******** Define main type %d, %s", pdudef, pduname);
 3465          tbl_typeref(0, PDUtree, sd.here, pabbrev_pdu_len-1);    /* strip initial . for new names */
 3466   
 3467          if (asn1_verbose)
 3468                  g_message("%d anonymous types", anonCount);
 3469   
 3470          /* Now make all types used available for matching */
 3471          if (asn1_verbose)
 3472                  g_message("Define the types that are actually referenced through the top level PDU");
 3473          for (i=0, tcount=0; i<numTypedefs; i++) {
 3474                  tr = &(typeDef_names[i]);
 3475   
 3476                  if (tr->pdu) {  /* ignore if not used in main pdu */
 3477                          tcount++;
 3478                          if (i == pdudef)
 3479                                  g_warning("pdu %d %s defined twice, TopLevel & type", pdudef, pduname);
 3480                          if (asn1_verbose)
 3481                                  g_message("******** Define type %d, %s", i, tr->name);
 3482   
 3483                          /* .... do definition ..... */
 3484                          info = g_malloc0(sizeof(PDUinfo));
 3485                          info->name = tr->name;
 3486                          info->typename = tr->name;
 3487                          info->tclass = tr->defclass;
 3488                          info->tag = tr->deftag;
 3489                          info->type = TBL_TYPEREF;
 3490                          info->fullname = g_strdup_printf("%s.--.%s", pabbrev, tr->name);
 3491                          info->flags = PDUinfo_initflags = PDU_TYPETREE;
 3492                          info->value_id = -1;
 3493                          info->type_id = -1;
 3494                          info->basetype = -1;
 3495                          info->mytype = i;
 3496   
 3497                          info->value_hf.p_id = &(info->value_id);
 3498                          info->value_hf.hfinfo.name = info->fullname;
 3499                          info->value_hf.hfinfo.abbrev = info->fullname;
 3500                          info->value_hf.hfinfo.type = tbl_types_wireshark[info->type];
 3501                          info->value_hf.hfinfo.display = BASE_DEC;
 3502                          info->value_hf.hfinfo.blurb = info->fullname;
 3503   
 3504                          tr->typetree = g_node_new(info);
 3505                          pabbrev_pdu_len = g_sprintf(fieldname, "%s.--.%s.", pabbrev, tr->name);
 3506                          tbl_typeref(0, tr->typetree, tr->type, pabbrev_pdu_len-1);
 3507                  }
 3508          }
 3509          if (asn1_verbose)
 3510                  g_message("%d types used", tcount);
 3511   
 3512          pabbrev_pdu_len = sav_len;
 3513   
 3514          /* and show the result */
 3515          if (asn1_verbose)
 3516                  g_message("Type index:");
 3517          for (i=0; i<numTypedefs; i++) {
 3518                  tr = &(typeDef_names[i]);
 3519   
 3520                  if (tr->pdu == 0) /* skip if not used */
 3521                          continue;
 3522   
 3523                  if (asn1_verbose)
 3524                          g_message("  %3d %s, %c%d, refs: %d",
 3525                                    i, tr->name, tag_class[tr->defclass], tr->deftag,
 3526                                    g_ptr_array_len(tr->refs));
 3527   
 3528                  /* get defining node for this type */
 3529                  defid = -1;
 3530                  if (tr->typetree) {
 3531                          p = (PDUinfo *)(tr->typetree->data);
 3532                          defid = p->value_id;
 3533                          if (asn1_verbose)
 3534                                  g_message("      -- defining id=%d", defid);
 3535                  }
 3536                  for(j=0; j < g_ptr_array_len(tr->refs); j++) {  /* show refs, and set type_id */
 3537                          p = (PDUinfo *)g_ptr_array_index(tr->refs, j);
 3538                          if (p->mytype == (gint)i)
 3539                                  p->type_id = defid;     /* normal reference */
 3540                          else {
 3541                                  if ((p->flags & PDU_TYPETREE) == 0) {
 3542                                          /* we have a primitive value, find its real type */
 3543                                          for(k=0; k < g_ptr_array_len(tr->refs); k++) {
 3544                                                          /* look at all refs */
 3545                                                  q = (PDUinfo *)g_ptr_array_index(tr->refs, k);
 3546                                                  if ((q->flags & PDU_TYPETREE) == 0)
 3547                                                          continue; /* only type trees are interresting */
 3548                                                  if (q->type != p->type)
 3549                                                          continue; /* must be same types */
 3550                                                  if (strcmp(q->name, p->name) == 0) {
 3551                                                          /* OK, take the first we find, not entirely
 3552                                                           * correct, it may be from a different
 3553                                                           * base-base type...... XXX */
 3554                                                          p->type_id = q->value_id;
 3555                                                          break;
 3556                                                  }
 3557                                          }
 3558                                  }
 3559                          }
 3560   
 3561                          if (asn1_verbose) {
 3562                                  PDUtext(text, p);
 3563                                  g_message("      %s", text);
 3564                          }
 3565                  }
 3566          }
 3567   
 3568          if (asn1_verbose)
 3569                  g_message("The resulting PDU tree:");
 3570          showPDUtree(PDUtree, 0);
 3571   
 3572          return TRUE;
 3573  }
Show more  




Change Warning 3610.30847 : Unreachable Call

Priority:
State:
Finding:
Owner:
Note: