(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/cosine.c) |
| |
| 504 | | | parse_single_hex_dump_line(char* rec, guint8 *buf, guint byte_offset) |
| 505 | | | { |
| 506 | | | int num_items_scanned, i; |
| 507 | | | unsigned int bytes[16]; |
| 508 | | | |
| 509 | | | num_items_scanned = sscanf(rec, "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", |
Event 2:
"%02x %02x %02x %02x %02x %02x ..." is passed to __isoc99_sscanf() as the second argument.
hide
|
|
| 510 | | | &bytes[0], &bytes[1], &bytes[2], &bytes[3], |
Event 1:
bytes is passed to __isoc99_sscanf() as the third argument.
hide
|
|
| 511 | | | &bytes[4], &bytes[5], &bytes[6], &bytes[7], |
| 512 | | | &bytes[8], &bytes[9], &bytes[10], &bytes[11], |
| 513 | | | &bytes[12], &bytes[13], &bytes[14], &bytes[15]); |
Event 3:
bytes[0] is set to a potentially dangerous value [ ?potentially dangerous: the value cannot be determined and may come from program input], where &bytes[0] is bytes. - Determines the value that is cast in the Cast Alters Value warning later.
See related events 1 and 2.
hide
|
|
| 514 | | | if (num_items_scanned == 0) |
Event 4:
Skipping " if". num_items_scanned == 0 evaluates to false.
hide
|
|
| 515 | | | return -1; |
| 516 | | | |
| 517 | | | if (num_items_scanned > 16) |
Event 5:
Skipping " if". num_items_scanned > 16 evaluates to false.
hide
|
|
| 518 | | | num_items_scanned = 16; |
| 519 | | | |
| 520 | | | for (i=0; i<num_items_scanned; i++) { |
Event 6:
i is set to 0.
hide
Event 7:
Entering loop body. i < num_items_scanned evaluates to true.
hide
|
|
| 521 | | | buf[byte_offset + i] = (guint8)bytes[i]; |
Cast Alters Value
bytes[0] is cast from unsigned int to unsigned char. - bytes[0] could be 256 or higher.
- bytes[0] evaluates to the value assigned to bytes[0] at cosine.c:509.
- 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 events 3 and 6. Show: All events | Only primary events |
|
| |