(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/netscreen.c) |
| |
| 157 | | | static gboolean netscreen_check_file_type(wtap *wth, int *err) |
| 158 | | | { |
| 159 | | | char buf[NETSCREEN_LINE_LENGTH]; |
| 160 | | | guint reclen, line; |
| 161 | | | |
| 162 | | | buf[NETSCREEN_LINE_LENGTH-1] = '\0'; |
| 163 | | | |
| 164 | | | for (line = 0; line < ; line++) { |
| 165 | | | if (file_gets(buf, NETSCREEN_LINE_LENGTH, wth->fh) != NULL) { |
| 166 | | | |
| 167 | | | reclen = (guint) strlen(buf); |
| 168 | | | if (reclen < strlen(NETSCREEN_HDR_MAGIC_STR1) || |
| 169 | | | reclen < strlen(NETSCREEN_HDR_MAGIC_STR2)) { |
Redundant Condition
reclen < strlen("(o) len=") always evaluates to false. 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 reclen < strlen("(o) len=") cannot be true.
- A crashing bug occurs on every path where reclen < strlen("(o) len=") could have evaluated to true. Look for a preceding Null Pointer Dereference or Division By Zero warning.
|
|
| 170 | | | continue; |
| 171 | | | } |
| 172 | | | |
| 173 | | | if (strstr(buf, NETSCREEN_HDR_MAGIC_STR1) || |
| 174 | | | strstr(buf, NETSCREEN_HDR_MAGIC_STR2)) { |
| 175 | | | return TRUE; |
| 176 | | | } |
| 177 | | | } else { |
| 178 | | | |
| 179 | | | if (file_eof(wth->fh)) |
| 180 | | | *err = 0; |
| 181 | | | else |
| 182 | | | *err = file_error(wth->fh); |
| 183 | | | return FALSE; |
| 184 | | | } |
| 185 | | | } |
| 186 | | | *err = 0; |
| 187 | | | return FALSE; |
| 188 | | | } |
| |