Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-10075

Coverity, ignoring number of bytes read

    XMLWordPrintable

Details

    Description

      Coverity found error handling of reading stream is not sufficient. There is no check if number of actual read bytes match number of expected read bytes. Without such check error will revealed in next processing. Preferred is to detect error early.

      KeyStoreCredentialStore.java
              private byte[] readBytes(ObjectInputStream ois) throws IOException {
                  int len = ois.readInt();
                  byte[] data = new byte[len];
                  ois.read(data, 0, len);
                  return data;
              }
      

      [1] https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=12563831&defectInstanceId=2991439&mergedDefectId=1422737

      Attachments

        Issue Links

          Activity

            People

              rhn-support-ivassile Ilia Vassilev
              mchoma@redhat.com Martin Choma
              Martin Choma Martin Choma
              Martin Choma Martin Choma
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: