crc.c: ensure the cksum length is sufficient
authorRichard Basch <probe@mit.edu>
Wed, 15 May 1996 00:58:34 +0000 (00:58 +0000)
committerRichard Basch <probe@mit.edu>
Wed, 15 May 1996 00:58:34 +0000 (00:58 +0000)
crc-test.c: set the cksum length field

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8022 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/crc32/ChangeLog
src/lib/crypto/crc32/crc.c
src/lib/crypto/crc32/crctest.c

index 3a2a1eebe2a440337e58083d6e08326a12e76a07..b9e7d9e12c95c851286cf28b5a6fafe222f66bcb 100644 (file)
@@ -1,3 +1,9 @@
+Tue May 14 19:33:27 1996  Richard Basch  <basch@lehman.com>
+
+       * crc.c: ensure the cksum content length is sufficient
+
+       * crctest.c: set the cksum length field.
+
 Sat Mar 30 22:54:12 1996  Theodore Y. Ts'o  <tytso@dcl>
 
        * Makefile.in (SRCS): Removed crctest.c from the SRCS list, since
index 48564b50ce277174d2df64a9e6f565d8dbefa6fb..9f055200aa446e489fa1be3da4741b671a582bab 100644 (file)
@@ -145,15 +145,15 @@ static u_long const crc_table[256] = {
 
 /* Windows needs to these prototypes for crc32_cksumtable_entry below */
 
-krb5_error_code
+static krb5_error_code
 crc32_sum_func PROTOTYPE((krb5_pointer in, size_t in_length,
     krb5_pointer seed, size_t seed_length, krb5_checksum *outcksum));
 
-krb5_error_code
+static krb5_error_code
 crc32_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in,
        size_t in_length, krb5_pointer seed, size_t seed_length));
 
-krb5_error_code
+static krb5_error_code
 crc32_sum_func(in, in_length, seed, seed_length, outcksum)
 krb5_pointer in;
 size_t in_length;
@@ -166,6 +166,9 @@ krb5_checksum FAR *outcksum;
     register int idx;
     size_t i;
 
+    if (outcksum->length < CRC32_CKSUM_LENGTH)
+       return KRB5_BAD_MSIZE;
+    
     data = (u_char *)in;
     for (i = 0; i < in_length; i++) {
        idx = (int) (data[i] ^ c);
@@ -183,7 +186,7 @@ krb5_checksum FAR *outcksum;
     return 0;
 }
 
-krb5_error_code
+static krb5_error_code
 crc32_verify_func(cksum, in, in_length, seed, seed_length)
 krb5_checksum FAR *cksum;
 krb5_pointer in;
index 58388227e8bb40675cd6a3a75f211fc2b6b23295..5f4fbd8c0fc142d618f12bb00ab99c0a50660302 100644 (file)
@@ -42,6 +42,7 @@ main()
 
     int bad = 0;
 
+    outck.length = sizeof(ckout);
     outck.contents = ckout;
 
     while (scanf("%s %s", input, expected_crc) == 2) {