check msg type before decoding
authorJohn Kohl <jtkohl@mit.edu>
Tue, 17 Apr 1990 17:39:53 +0000 (17:39 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Tue, 17 Apr 1990 17:39:53 +0000 (17:39 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@483 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/decode_kdc.c
src/lib/krb5/krb/gc_via_tgt.c
src/lib/krb5/krb/rd_priv.c
src/lib/krb5/krb/rd_req.c
src/lib/krb5/krb/rd_safe.c

index b30d233302c11644eaec6f8293464d47303be4bf..f01600c5b46b157c6e5325c7d4d953821210b894 100644 (file)
@@ -54,6 +54,8 @@ OLDDECLARG(krb5_kdc_rep **, dec_rep)
 
 
     /* XXX maybe caller should specify type expected? */
+    if (!krb5_is_kdc_rep(enc_rep))
+       return KRB5KRB_AP_ERR_MSG_TYPE;
     retval = decode_krb5_as_rep(enc_rep, &local_dec_rep);
     switch (retval) {
     case ISODE_50_LOCAL_ERR_BADMSGTYPE:
index fef01b432422674b2a41ef29aaf8ae162881263e..3152ca7bd42d61eca3f740c5fd43dfe93f817477 100644 (file)
@@ -81,7 +81,11 @@ OLDDECLARG(krb5_creds *, cred)
        break;
     case KRB5_ERROR:
     default:
-       if (decode_krb5_error(&tgsrep.response, &err_reply)) {
+       if (!krb5_is_krb_error(&tgsrep.response)) {
+           retval = KRB5KRB_AP_ERR_MSG_TYPE;
+       } else
+           retval = decode_krb5_error(&tgsrep.response, &err_reply);
+       if (retval) {
            cleanup();
            return retval;              /* neither proper reply nor error! */
        }
index 037f15f36ae2558e9f9ae634fa69e6ce1f81a7b1..31e06d87bd74965a1cd9705936ac33a02aa73626 100644 (file)
@@ -49,6 +49,8 @@ OLDDECLARG(krb5_data *, outbuf)
     krb5_timestamp currenttime;
     krb5_ui_2 computed_direction;
 
+    if (!krb5_is_krb_priv(inbuf))
+       return KRB5KRB_AP_ERR_MSG_TYPE;
     /* decode private message */
     if (retval = decode_krb5_priv(inbuf, &privmsg))  {
        return retval;
index 8908d4be5d1dacb6179cf514dde6d293ea701de2..1dc1530950b8216c460333c5992be6b437c57558 100644 (file)
@@ -65,6 +65,8 @@ krb5_tkt_authent *authdat;
     krb5_error_code retval;
     krb5_ap_req *request;
 
+    if (!krb5_is_ap_req(inbuf))
+       return KRB5KRB_AP_ERR_MSG_TYPE;
     if (retval = decode_krb5_ap_req(inbuf, &request)) {
        switch (retval) {
        case ISODE_50_LOCAL_ERR_BADMSGTYPE:
index 4864cc2b3fe310935942c80c2ee48b078399e238..0154e5cf2d5854dd1811bf71532f47e251e8c915 100644 (file)
@@ -56,6 +56,9 @@ krb5_data *outbuf;
     krb5_data *scratch;
     krb5_timestamp currenttime;
 
+    if (!krb5_is_krb_safe(inbuf))
+       return KRB5KRB_AP_ERR_MSG_TYPE;
+
     if (retval = decode_krb5_safe(inbuf, &message))
        return retval;