(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/airopeek9.c) |
| |
| 94 | | | static int wtap_file_read_pattern (wtap *wth, const char *pattern, int *err) |
| 95 | | | { |
| 96 | | | int c; |
| 97 | | | const char *cp; |
| 98 | | | |
| 99 | | | cp = pattern; |
| 100 | | | while (*cp) |
| 101 | | | { |
| 102 | | | c = file_getc(wth->fh); |
| 103 | | | if (c == EOF) { |
| 104 | | | if (file_eof(wth->fh)) |
| 105 | | | return 0; |
| 106 | | | else { |
| 107 | | | |
| 108 | | | |
| 109 | | | |
| 110 | | | *err = file_error(wth->fh); |
| 111 | | | return -1; |
| 112 | | | } |
| 113 | | | } |
| 114 | | | if (c == *cp) |
| 115 | | | cp++; |
| 116 | | | else |
| 117 | | | { |
| 118 | | | if (c == pattern[0]) |
| 119 | | | cp = &pattern[1]; |
| 120 | | | else |
| 121 | | | cp = pattern; |
| 122 | | | } |
| 123 | | | } |
| 124 | | | return (*cp == '\0' ? 1 : 0); |
Redundant Condition
*cp == 0 always evaluates to true. This may be because: - There is a constant assignment to one or more of the variables involved.
- An earlier conditional statement has already ensured that *cp == 0 cannot be false.
- A crashing bug occurs on every path where *cp == 0 could have evaluated to false. Look for a preceding Null Pointer Dereference or Division By Zero warning.
|
|
| 125 | | | } |
| |