(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/strutil.c) |
| |
| 552 | | | uri_str_to_bytes(const char *uri_str, GByteArray *bytes) { |
| 553 | | | guint8 val; |
| 554 | | | const guchar *p; |
| 555 | | | guchar hex_digit[HEX_DIGIT_BUF_LEN]; |
| 556 | | | |
| 557 | | | g_byte_array_set_size(bytes, 0); |
| 558 | | | if (! uri_str) { |
Event 2:
Skipping " if". uri_str evaluates to true.
hide
|
|
| 559 | | | return FALSE; |
| 560 | | | } |
| 561 | | | |
| 562 | | | p = (const guchar *)uri_str; |
| 563 | | | |
| 564 | | | while (*p) { |
Event 3:
Entering loop body. *p evaluates to true.
hide
|
|
| 565 | | | if (! isascii(*p) || ! isprint(*p)) |
Event 4:
Skipping " if". - isascii(*p) evaluates to true.
- isprint(*p) evaluates to true.
hide
|
|
| 566 | | | return FALSE; |
| 567 | | | if (*p == '%') { |
Event 5:
Taking true branch. *p == 37 evaluates to true.
hide
|
|
| 568 | | | p++; |
| 569 | | | if (*p == '\0') return FALSE; |
Event 6:
Skipping " if". *p == 0 evaluates to false.
hide
|
|
| 570 | | | hex_digit[0] = *p; |
| 571 | | | p++; |
| 572 | | | if (*p == '\0') return FALSE; |
Event 7:
Skipping " if". *p == 0 evaluates to false.
hide
|
|
| 573 | | | hex_digit[1] = *p; |
| 574 | | | hex_digit[2] = '\0'; |
| 575 | | | if (! isxdigit(hex_digit[0]) || ! isxdigit(hex_digit[1])) |
Event 8:
Skipping " if". - isxdigit(hex_digit[0]) evaluates to true.
- isxdigit(hex_digit[1]) evaluates to true.
hide
|
|
| 576 | | | return FALSE; |
| 577 | | | val = (guint8) strtoul((char *)hex_digit, NULL, 16); |
Event 9:
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(...) is cast from unsigned long to unsigned char. - strtoul(...) 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 9. Show: All events | Only primary events |
|
| |