(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-cmpp.c) |
| |
| 544 | | | dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 545 | | | { |
| 546 | | | |
| 547 | | | |
| 548 | | | proto_item *ti; |
| 549 | | | proto_tree *cmpp_tree; |
| 550 | | | guint command_id; |
| 551 | | | guint tvb_len; |
| 552 | | | guint total_length; |
| 553 | | | const gchar *command_str; |
| 554 | | | |
| 555 | | | |
| 556 | | | tvb_len = tvb_length(tvb); |
| 557 | | | |
| 558 | | | if (tvb_len < ) |
| 559 | | | return; |
| 560 | | | |
| 561 | | | total_length = tvb_get_ntohl(tvb, 0); |
| 562 | | | command_id = tvb_get_ntohl(tvb, 4); |
| 563 | | | |
| 564 | | | if (match_strval(command_id, vals_command_Id) == NULL) |
| 565 | | | { |
| 566 | | | |
| 567 | | | return; |
| 568 | | | } |
| 569 | | | |
| 570 | | | command_str = val_to_str(command_id, vals_command_Id, |
| 571 | | | "(Unknown CMPP Operation 0x%08X)"); |
Ignored Return Value
The return value of val_to_str() is never checked in the highlighted execution scenario. - If the return value can indicate an error, the error will be ignored if the highlighted code executes.
- The return value of val_to_str() is checked 98% of the time in this project. CodeSonar is configured to enforce Ignored Return Value checks for any function whose return value is checked at least 96% of the time, unless the function is used fewer than 20 times. (To modify these thresholds, use configuration file parameters RETURN_CHECKER_SAMPLE_SIZE and RETURN_CHECKER_RATIO. To exempt val_to_str() from the Ignored Return Value check, use configuration file parameter RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 572 | | | |
| 573 | | | |
| 574 | | | if (tvb_len < total_length) |
Event 2:
Taking true branch. tvb_len < total_length evaluates to true.
hide
|
|
| 575 | | | { |
| 576 | | | |
| 577 | | | return; |
| 578 | | | } |
| 579 | | | |
| 580 | | | |
| 581 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 582 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "CMPP"); |
| 583 | | | |
| 584 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
| 585 | | | { |
| 586 | | | col_append_fstr(pinfo->cinfo, COL_INFO, "%s. ", command_str); |
| 587 | | | } |
| 588 | | | |
| 589 | | | if (tree) |
| 590 | | | { |
| 591 | | | ti = proto_tree_add_item(tree, proto_cmpp, tvb, 0, -1, FALSE); |
| 592 | | | |
| 593 | | | cmpp_tree = proto_item_add_subtree(ti, ett_cmpp); |
| 594 | | | |
| 595 | | | |
| 596 | | | cmpp_uint4(cmpp_tree, tvb, hf_cmpp_Total_Length, 0); |
| 597 | | | cmpp_uint4(cmpp_tree, tvb, hf_cmpp_Command_Id, 4); |
| 598 | | | cmpp_uint4(cmpp_tree, tvb, hf_cmpp_Sequence_Id, 8); |
| 599 | | | |
| 600 | | | switch(command_id) |
| 601 | | | { |
| 602 | | | case CMPP_CONNECT: |
| 603 | | | cmpp_connect(cmpp_tree, tvb); |
| 604 | | | break; |
| 605 | | | case CMPP_CONNECT_RESP: |
| 606 | | | cmpp_connect_resp(cmpp_tree, tvb); |
| 607 | | | break; |
| 608 | | | |
| 609 | | | case CMPP_TERMINATE: |
| 610 | | | case CMPP_TERMINATE_RESP: |
| 611 | | | break; |
| 612 | | | case CMPP_SUBMIT: |
| 613 | | | cmpp_submit(cmpp_tree, tvb); |
| 614 | | | break; |
| 615 | | | case CMPP_SUBMIT_RESP: |
| 616 | | | cmpp_submit_resp(cmpp_tree, tvb); |
| 617 | | | break; |
| 618 | | | case CMPP_DELIVER: |
| 619 | | | cmpp_deliver(cmpp_tree, tvb); |
| 620 | | | break; |
| 621 | | | case CMPP_DELIVER_RESP: |
| 622 | | | cmpp_deliver_resp(cmpp_tree, tvb); |
| 623 | | | break; |
| 624 | | | default: |
| 625 | | | |
| 626 | | | break; |
| 627 | | | } |
| 628 | | | } |
| 629 | | | } |
| |