Skip to content

Commit

Permalink
Bug #3623: NPE in tigase.jaxmpp.j2se.connectors.socket.HostnameVerifier
Browse files Browse the repository at this point in the history
fix: potential NPE in verifyIP() method
  • Loading branch information
bmalkow committed Oct 19, 2015
1 parent 33cbfec commit 6b656c4
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,17 @@ protected boolean verifyIp(String ipAddr, X509Certificate x509Certificate) throw
log.warning("Certificate is NULL! Can't validate hostname.");
return false;
}
for (List<?> entry : x509Certificate.getSubjectAlternativeNames()) {
Integer altNameType = (Integer) entry.get(0);
if (altNameType != 7)
continue;
String altName = (String) entry.get(1);
if (ipAddr.equalsIgnoreCase(altName)) {
return true;
final Collection<List<?>> subjectAlternativeNames = x509Certificate.getSubjectAlternativeNames();
if (subjectAlternativeNames != null)
for (List<?> entry : x509Certificate.getSubjectAlternativeNames()) {
Integer altNameType = (Integer) entry.get(0);
if (altNameType != 7)
continue;
String altName = (String) entry.get(1);
if (ipAddr.equalsIgnoreCase(altName)) {
return true;
}
}
}
return false;
}

Expand Down

0 comments on commit 6b656c4

Please sign in to comment.