Check alloc_data result in krb5int_old_encrypt
authorGreg Hudson <ghudson@mit.edu>
Sun, 13 May 2012 19:42:50 +0000 (15:42 -0400)
committerGreg Hudson <ghudson@mit.edu>
Sun, 13 May 2012 19:42:50 +0000 (15:42 -0400)
src/lib/crypto/krb/enc_old.c

index f33cacb5c4c6b129b2a33d13b577c8b8ea578b9a..e7160b16928749d5008d79cb0bb13560678fa137 100644 (file)
@@ -104,6 +104,8 @@ krb5int_old_encrypt(const struct krb5_keytypes *ktp, krb5_key key,
     /* Use the key as the ivec for des-cbc-crc if none was provided. */
     if (key->keyblock.enctype == ENCTYPE_DES_CBC_CRC && ivec == NULL) {
         ret = alloc_data(&crcivec, key->keyblock.length);
+        if (ret != 0)
+            goto cleanup;
         memcpy(crcivec.data, key->keyblock.contents, key->keyblock.length);
         ivec = &crcivec;
     }