Uploaded image for project: 'WildFly Elytron'
  1. WildFly Elytron
  2. ELY-1051

Coverity, derefere null return value in KeyStoreCredentialStore.store

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 1.1.0.Beta42
    • None
    • None
    • None

      Coverity found possible null dereference as getEntry() could return null.

      https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=12563831&defectInstanceId=2991455&mergedDefectId=1422740

      KeyStoreCredentialStore.java
              void store(OutputStream outputStream) throws IOException, GeneralSecurityException {
                  ObjectOutputStream oos = new ObjectOutputStream(outputStream);
                  oos.writeInt(VERSION);
                  Enumeration<String> ksAliases = dataKeyStore.aliases();
                  while(ksAliases.hasMoreElements()) {
                      String alias = ksAliases.nextElement();
                      KeyStore.Entry entry = dataKeyStore.getEntry(alias, convertParameter(protectionParameter));
                      if (entry instanceof KeyStore.SecretKeyEntry) {
                          saveSecretKey(alias, oos, (KeyStore.SecretKeyEntry)entry);
                      } else {
                          throw log.unrecognizedEntryType(entry.getClass().getCanonicalName());
                      }
                  }
                  oos.flush();
                  oos.close();
              }
      

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

                Created:
                Updated:
                Resolved: