From: Tom Yu Date: Mon, 14 Jul 2008 22:13:19 +0000 (+0000) Subject: pull up r20480 from trunk X-Git-Tag: kfw-3.2.3-alpha1~37 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=34acbd0b9a4d5a27c65c032a96ddf00ab16d8e2f;p=krb5.git pull up r20480 from trunk r20480@cathode-dark-space: raeburn | 2008-06-26 21:26:08 -0400 ticket: new subject: fix free of automatic storage target_version: 1.6.4 tags: pullup Fix a possible free of automatic storage that can happen on an (unlikely) encoding failure. ticket: 5996 version_fixed: 1.6.4 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@20523 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/rd_safe.c b/src/lib/krb5/krb/rd_safe.c index 15dc6dccc..a9de11940 100644 --- a/src/lib/krb5/krb/rd_safe.c +++ b/src/lib/krb5/krb/rd_safe.c @@ -1,7 +1,7 @@ /* * lib/krb5/krb/rd_safe.c * - * Copyright 1990,1991 by the Massachusetts Institute of Technology. + * Copyright 1990,1991,2007,2008 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -114,11 +114,11 @@ krb5_rd_safe_basic(krb5_context context, const krb5_data *inbuf, const krb5_keyb message->checksum = &our_cksum; - if ((retval = encode_krb5_safe_with_body(message, &safe_body, &scratch))) + retval = encode_krb5_safe_with_body(message, &safe_body, &scratch); + message->checksum = his_cksum; + if (retval) goto cleanup; - message->checksum = his_cksum; - retval = krb5_c_verify_checksum(context, keyblock, KRB5_KEYUSAGE_KRB_SAFE_CKSUM, scratch, his_cksum, &valid);