(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/cosine.c) |
| |
| 248 | | | static gboolean cosine_check_file_type(wtap *wth, int *err) |
| 249 | | | { |
| 250 | | | char buf[COSINE_LINE_LENGTH]; |
| 251 | | | gsize reclen; |
| 252 | | | guint line; |
| 253 | | | |
| 254 | | | buf[COSINE_LINE_LENGTH-1] = '\0'; |
| 255 | | | |
| 256 | | | for (line = 0; line < ; line++) { |
| 257 | | | if (file_gets(buf, COSINE_LINE_LENGTH, wth->fh) != NULL) { |
| 258 | | | |
| 259 | | | reclen = strlen(buf); |
| 260 | | | if (reclen < strlen(COSINE_HDR_MAGIC_STR1) || |
| 261 | | | reclen < strlen(COSINE_HDR_MAGIC_STR2)) { |
Redundant Condition
reclen < strlen("l2-rx") 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("l2-rx") cannot be true.
- A crashing bug occurs on every path where reclen < strlen("l2-rx") could have evaluated to true. Look for a preceding Null Pointer Dereference or Division By Zero warning.
|
|
| 262 | | | continue; |
| 263 | | | } |
| 264 | | | |
| 265 | | | if (strstr(buf, COSINE_HDR_MAGIC_STR1) || |
| 266 | | | strstr(buf, COSINE_HDR_MAGIC_STR2)) { |
| 267 | | | return TRUE; |
| 268 | | | } |
| 269 | | | } else { |
| 270 | | | |
| 271 | | | if (file_eof(wth->fh)) |
| 272 | | | *err = 0; |
| 273 | | | else |
| 274 | | | *err = file_error(wth->fh); |
| 275 | | | return FALSE; |
| 276 | | | } |
| 277 | | | } |
| 278 | | | *err = 0; |
| 279 | | | return FALSE; |
| 280 | | | } |
| |