(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/vms.c) |
| |
| 208 | | | static gboolean vms_check_file_type(wtap *wth, int *err) |
| 209 | | | { |
| 210 | | | char buf[VMS_LINE_LENGTH]; |
| 211 | | | guint reclen, line; |
| 212 | | | gint64 mpos; |
| 213 | | | |
| 214 | | | buf[VMS_LINE_LENGTH-1] = '\0'; |
| 215 | | | |
| 216 | | | for (line = 0; line < ; line++) { |
| 217 | | | mpos = file_tell(wth->fh); |
| 218 | | | if (mpos == -1) { |
| 219 | | | |
| 220 | | | *err = file_error(wth->fh); |
| 221 | | | return FALSE; |
| 222 | | | } |
| 223 | | | if (file_gets(buf, VMS_LINE_LENGTH, wth->fh) != NULL) { |
| 224 | | | |
| 225 | | | reclen = (guint) strlen(buf); |
| 226 | | | if (reclen < strlen(VMS_HDR_MAGIC_STR1) || |
| 227 | | | reclen < strlen(VMS_HDR_MAGIC_STR2) || |
Redundant Condition
reclen < strlen("TCPtrace") 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("TCPtrace") cannot be true.
- A crashing bug occurs on every path where reclen < strlen("TCPtrace") could have evaluated to true. Look for a preceding Null Pointer Dereference or Division By Zero warning.
|
|
| 228 | | | reclen < strlen(VMS_HDR_MAGIC_STR3)) { |
| 229 | | | continue; |
| 230 | | | } |
| 231 | | | |
| 232 | | | if (strstr(buf, VMS_HDR_MAGIC_STR1) || |
| 233 | | | strstr(buf, VMS_HDR_MAGIC_STR2) || |
| 234 | | | strstr(buf, VMS_HDR_MAGIC_STR3)) { |
| 235 | | | |
| 236 | | | |
| 237 | | | if (file_seek(wth->fh, mpos, SEEK_SET, err) == -1) {
x /usr/include/stdio.h |
| |
141 | #define SEEK_SET 0 /* Seek from beginning of file. */ |
| |
|
| 238 | | | |
| 239 | | | return FALSE; |
| 240 | | | } |
| 241 | | | return TRUE; |
| 242 | | | } |
| 243 | | | } else { |
| 244 | | | |
| 245 | | | if (file_eof(wth->fh)) |
| 246 | | | *err = 0; |
| 247 | | | else |
| 248 | | | *err = file_error(wth->fh); |
| 249 | | | return FALSE; |
| 250 | | | } |
| 251 | | | } |
| 252 | | | *err = 0; |
| 253 | | | return FALSE; |
| 254 | | | } |
| |