Text   |  XML   |  ReML   |   Visible Warnings:

Redundant Condition  at vms.c:227

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

vms_check_file_type

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/vms.c)expand/collapse
Show more  
 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 < VMS_HEADER_LINES_TO_CHECK; line++) {
 217      mpos = file_tell(wth->fh);
 218      if (mpos == -1) {
 219        /* Error. */
 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) ||  
 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          /* Go back to the beginning of this line, so we will 
 236           * re-read it. */
 237          if (file_seek(wth->fh, mpos, SEEK_SET, err) == -1) {
 238            /* Error. */
 239            return FALSE;
 240          }
 241          return TRUE;
 242        }
 243      } else {
 244        /* EOF or error. */
 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  }
Show more  




Change Warning 1062.29808 : Redundant Condition

Priority:
State:
Finding:
Owner:
Note: