6958060: Malformed AP-REQ crashes acceptor side
authorweijun
Thu, 17 Jun 2010 12:59:21 +0800
changeset 6860 5b1c9a7c3b80
parent 6859 0b0cdd787307
child 6861 0c879c7c2ea2
6958060: Malformed AP-REQ crashes acceptor side Reviewed-by: valeriep, xuelei
jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java
--- a/jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java	Thu Jun 17 12:59:14 2010 +0800
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java	Thu Jun 17 12:59:21 2010 +0800
@@ -35,7 +35,6 @@
 import java.security.NoSuchAlgorithmException;
 import java.util.Arrays;
 import sun.security.krb5.*;
-import sun.security.jgss.HttpCaller;
 import sun.security.krb5.internal.Krb5;
 
 abstract class InitialToken extends Krb5Token {
@@ -217,6 +216,12 @@
 
             int pos = 0;
 
+            if (checksum == null) {
+                GSSException ge = new GSSException(GSSException.FAILURE, -1,
+                        "No cksum in AP_REQ's authenticator");
+                ge.initCause(new KrbException(Krb5.KRB_AP_ERR_INAPP_CKSUM));
+                throw ge;
+            }
             checksumBytes = checksum.getBytes();
 
             if ((checksumBytes[0] != CHECKSUM_FIRST_BYTES[0]) ||