pull up r19913 from trunk
authorTom Yu <tlyu@mit.edu>
Wed, 5 Sep 2007 21:26:16 +0000 (21:26 +0000)
committerTom Yu <tlyu@mit.edu>
Wed, 5 Sep 2007 21:26:16 +0000 (21:26 +0000)
 r19913@cathode-dark-space:  tlyu | 2007-09-04 14:52:56 -0400
 ticket: new
 subject: fix CVE-2007-3999 svc_auth_gss.c buffer overflow
 target_version: 1.6.3
 tags: pullup
 component: krb5-libs

 Make sure svcauth_gss_validate adequately checks oa->oa_length prior
 to copying into rpcbuf.

ticket: 5706

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@19924 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/rpc/svc_auth_gss.c

index 78da340cb27b949db8b4ce1ca313a56ab88507b1..d1cfb1c91ef57e79d7b5e8764275991d4e29488c 100644 (file)
@@ -365,7 +365,7 @@ svcauth_gss_validate(struct svc_req *rqst, struct svc_rpc_gss_data *gd, struct r
        oa = &msg->rm_call.cb_cred;
        IXDR_PUT_ENUM(buf, oa->oa_flavor);
        IXDR_PUT_LONG(buf, oa->oa_length);
-       if (oa->oa_length) {
+       if (oa->oa_length && oa->oa_length <= sizeof(rpchdr)) {
                memcpy((caddr_t)buf, oa->oa_base, oa->oa_length);
                buf += RNDUP(oa->oa_length) / sizeof(int32_t);
        }