(/home/sate/Testcases/c/cve/wireshark-1.2.0/version_info.c) |
| |
| 105 | | | end_string(GString *str) |
| 106 | | | { |
| 107 | | | size_t point; |
| 108 | | | char *p, *q; |
| 109 | | | |
| 110 | | | point = strlen(str->str); |
| 111 | | | if (point == 0 || str->str[point - 1] != '\n') |
Event 1:
Taking true branch. point == 0 evaluates to true.
hide
|
|
| 112 | | | g_string_append(str, "\n"); |
| 113 | | | p = str->str; |
| 114 | | | while (*p != '\0') { |
Event 3:
Entering loop body. *p != 0 evaluates to true.
hide
Null Pointer Dereference
p is dereferenced here, but it has an invalid value. - p evaluates to 1.
- CodeSonar is configured to issue warnings when code dereferences pointers whose value is lower than 4096. (This value can be adjusted using configuration parameter NULL_POINTER_THRESHOLD.).
The issue can occur if the highlighted code executes. See related event 7. Show: All events | Only primary events |
|
| 115 | | | q = strchr(p, '\n'); |
Event 4:
strchr() returns NULL. - Dereferenced later, causing the null pointer dereference.
hide
Event 5:
q is set to strchr(p, 10), which evaluates to NULL. See related event 4.
hide
|
|
| 116 | | | if (q - p > 80) { |
Event 6:
Skipping " if". q - p > 80 evaluates to false.
hide
|
|
| 117 | | | |
| 118 | | | |
| 119 | | | |
| 120 | | | q = p + 80; |
| 121 | | | while (q > p && *q != ' ') |
| 122 | | | q--; |
| 123 | | | if (q != p) |
| 124 | | | *q = '\n'; |
| 125 | | | } |
| 126 | | | p = q + 1; |
Event 7:
p is set to q + 1, which evaluates to 1. See related event 5.
hide
|
|
| |