(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/vms.c) |
| |
| 514 | | | parse_single_hex_dump_line(char* rec, guint8 *buf, long byte_offset, |
| 515 | | | int in_off, int remaining) { |
| 516 | | | |
| 517 | | | int i; |
| 518 | | | char *s; |
| 519 | | | int value; |
| 520 | | | static const int offsets[16] = {39,37,35,33,28,26,24,22,17,15,13,11,6,4,2,0}; |
| 521 | | | char lbuf[3] = {0,0,0}; |
| 522 | | | |
| 523 | | | |
| 524 | | | |
| 525 | | | s = rec; |
| 526 | | | value = (int)strtoul(s + 45 + in_off, NULL, 16); |
| 527 | | | |
| 528 | | | if (value != byte_offset) { |
Event 1:
Skipping " if". value != byte_offset evaluates to false.
hide
|
|
| 529 | | | return FALSE; |
| 530 | | | } |
| 531 | | | |
| 532 | | | if (remaining > 16) |
Event 2:
Skipping " if". remaining > 16 evaluates to false.
hide
|
|
| 533 | | | remaining = 16; |
| 534 | | | |
| 535 | | | |
| 536 | | | |
| 537 | | | |
| 538 | | | |
| 539 | | | for (i = 0; i < remaining; i++) { |
Event 3:
Entering loop body. i < remaining evaluates to true.
hide
|
|
| 540 | | | lbuf[0] = rec[offsets[i] + in_off]; |
| 541 | | | lbuf[1] = rec[offsets[i] + 1 + in_off]; |
| 542 | | | |
| 543 | | | buf[byte_offset + i] = (guint8) strtoul(lbuf, NULL, 16); |
Event 4:
strtoul() returns a potentially dangerous value [ ?potentially dangerous: the value cannot be determined and may come from program input]. - Determines the value that is cast in the Cast Alters Value warning later.
hide
Cast Alters Value
strtoul(lbuf, (void *)0, 16) is cast from unsigned long to unsigned char. - strtoul(lbuf, (void *)0, 16) could be 256 or higher.
- Values 256 or higher cannot be stored as unsigned char. Casting them to unsigned char can cause data loss or sign change.
The issue can occur if the highlighted code executes. See related event 4. Show: All events | Only primary events |
|
| |