(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/asn1/packet-asn1.c) |
| |
| 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);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3413 | | | |
| 3414 | | | if (!data_nodes) { |
| 3415 | | | if (asn1_verbose) g_message("no data nodes");
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 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) { |
Redundant Condition
sd.here always evaluates to false. This may be because: - There is a constant assignment to one or more of the variables involved.
- An earlier conditional statement has already ensured that sd.here cannot be true.
- A crashing bug occurs on every path where sd.here could have evaluated to true. Look for a preceding Null Pointer Dereference or Division By Zero warning.
|
|
| 3422 | | | pdudef = ((TBLTypeDef *)(sd.here->data))->typeDefId; |
| 3423 | | | if (asn1_verbose) g_message("%s found, %p, typedef %d", sd.key, sd.here, pdudef);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3424 | | | } else { |
| 3425 | | | if (asn1_verbose) g_message("%s not found, ignored", sd.key);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3426 | | | return FALSE; |
| 3427 | | | } |
| 3428 | | | |
| 3429 | | | |
| 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 | | | |
| 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; |
| 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 | | | |
| 3463 | | | if (asn1_verbose) |
| 3464 | | | g_message("******** Define main type %d, %s", pdudef, pduname);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3465 | | | tbl_typeref(0, PDUtree, sd.here, pabbrev_pdu_len-1); |
| 3466 | | | |
| 3467 | | | if (asn1_verbose) |
| 3468 | | | g_message("%d anonymous types", anonCount);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3469 | | | |
| 3470 | | | |
| 3471 | | | if (asn1_verbose) |
| 3472 | | | g_message("Define the types that are actually referenced through the top level PDU");
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3473 | | | for (i=0, tcount=0; i<numTypedefs; i++) { |
| 3474 | | | tr = &(typeDef_names[i]); |
| 3475 | | | |
| 3476 | | | if (tr->pdu) { |
| 3477 | | | tcount++; |
| 3478 | | | if (i == pdudef) |
| 3479 | | | g_warning("pdu %d %s defined twice, TopLevel & type", pdudef, pduname);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
153 | #define g_warning(...) g_log (G_LOG_DOMAIN, \ |
154 | G_LOG_LEVEL_WARNING, \ |
155 | __VA_ARGS__) |
| |
|
| 3480 | | | if (asn1_verbose) |
| 3481 | | | g_message("******** Define type %d, %s", i, tr->name);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3482 | | | |
| 3483 | | | |
| 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);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3511 | | | |
| 3512 | | | pabbrev_pdu_len = sav_len; |
| 3513 | | | |
| 3514 | | | |
| 3515 | | | if (asn1_verbose) |
| 3516 | | | g_message("Type index:");
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3517 | | | for (i=0; i<numTypedefs; i++) { |
| 3518 | | | tr = &(typeDef_names[i]); |
| 3519 | | | |
| 3520 | | | if (tr->pdu == 0) |
| 3521 | | | continue; |
| 3522 | | | |
| 3523 | | | if (asn1_verbose) |
| 3524 | | | g_message(" %3d %s, %c%d, refs: %d",
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3525 | | | i, tr->name, tag_class[tr->defclass], tr->deftag, |
| 3526 | | | g_ptr_array_len(tr->refs)); |
| 3527 | | | |
| 3528 | | | |
| 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);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3535 | | | } |
| 3536 | | | for(j=0; j < g_ptr_array_len(tr->refs); j++) { |
| 3537 | | | p = (PDUinfo *)g_ptr_array_index(tr->refs, j);
x /usr/include/glib-2.0/glib/garray.h |
| |
111 | #define g_ptr_array_index(array,index_) ((array)->pdata)[index_] |
| |
|
| 3538 | | | if (p->mytype == (gint)i) |
| 3539 | | | p->type_id = defid; |
| 3540 | | | else { |
| 3541 | | | if ((p->flags & PDU_TYPETREE) == 0) { |
| 3542 | | | |
| 3543 | | | for(k=0; k < g_ptr_array_len(tr->refs); k++) { |
| 3544 | | | |
| 3545 | | | q = (PDUinfo *)g_ptr_array_index(tr->refs, k);
x /usr/include/glib-2.0/glib/garray.h |
| |
111 | #define g_ptr_array_index(array,index_) ((array)->pdata)[index_] |
| |
|
| 3546 | | | if ((q->flags & PDU_TYPETREE) == 0) |
| 3547 | | | continue; |
| 3548 | | | if (q->type != p->type) |
| 3549 | | | continue; |
| 3550 | | | if (strcmp(q->name, p->name) == 0) { |
| 3551 | | | |
| 3552 | | | |
| 3553 | | | |
| 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);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3564 | | | } |
| 3565 | | | } |
| 3566 | | | } |
| 3567 | | | |
| 3568 | | | if (asn1_verbose) |
| 3569 | | | g_message("The resulting PDU tree:");
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 3570 | | | showPDUtree(PDUtree, 0); |
| 3571 | | | |
| 3572 | | | return TRUE; |
| 3573 | | | } |
| |