(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-iscsi.c) |
| |
| 564 | | | handleDataDigest(proto_item *ti, tvbuff_t *tvb, guint offset, int dataLen) { |
| 565 | [+] | | int available_bytes = tvb_length_remaining(tvb, offset); |
 |
| 566 | | | if(enableDataDigests) { |
Event 6:
Taking true branch. enableDataDigests evaluates to true.
hide
|
|
| 567 | | | if(dataDigestIsCRC32) { |
Event 7:
Skipping " if". dataDigestIsCRC32 evaluates to false.
hide
|
|
| 568 | | | if(available_bytes >= (dataLen + 4)) { |
| 569 | | | guint32 crc = ~calculate_crc32c(tvb_get_ptr(tvb, offset, dataLen), dataLen, CRC32C_PRELOAD); |
| 570 | | | guint32 sent = tvb_get_ntohl(tvb, offset + dataLen); |
| 571 | | | if(crc == sent) { |
| 572 | | | proto_tree_add_uint_format(ti, hf_iscsi_DataDigest32, tvb, offset + dataLen, 4, sent, "DataDigest: 0x%08x (Good CRC32)", sent); |
| 573 | | | } |
| 574 | | | else { |
| 575 | | | proto_tree_add_uint_format(ti, hf_iscsi_DataDigest32, tvb, offset + dataLen, 4, sent, "DataDigest: 0x%08x (Bad CRC32, should be 0x%08x)", sent, crc); |
| 576 | | | } |
| 577 | | | } |
| 578 | | | return offset + dataLen + 4; |
| 579 | | | } |
| 580 | | | if((unsigned)available_bytes >= (dataLen + dataDigestSize)) { |
Cast Alters Value
available_bytes is cast from int to unsigned int. - available_bytes evaluates to -1.
- Negative values cannot be stored as unsigned int. Casting them to unsigned int can cause data loss or sign change.
The issue can occur if the highlighted code executes. See related event 5. Show: All events | Only primary events |
|
| |