From: Richard Basch Date: Wed, 15 May 1996 00:58:34 +0000 (+0000) Subject: crc.c: ensure the cksum length is sufficient X-Git-Tag: krb5-1.0-beta6~89 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a4ea4b3ae7ae82ccf4139306a46ebad43701e924;p=krb5.git crc.c: ensure the cksum length is sufficient crc-test.c: set the cksum length field git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8022 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/crc32/ChangeLog b/src/lib/crypto/crc32/ChangeLog index 3a2a1eebe..b9e7d9e12 100644 --- a/src/lib/crypto/crc32/ChangeLog +++ b/src/lib/crypto/crc32/ChangeLog @@ -1,3 +1,9 @@ +Tue May 14 19:33:27 1996 Richard Basch + + * 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 * Makefile.in (SRCS): Removed crctest.c from the SRCS list, since diff --git a/src/lib/crypto/crc32/crc.c b/src/lib/crypto/crc32/crc.c index 48564b50c..9f055200a 100644 --- a/src/lib/crypto/crc32/crc.c +++ b/src/lib/crypto/crc32/crc.c @@ -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; diff --git a/src/lib/crypto/crc32/crctest.c b/src/lib/crypto/crc32/crctest.c index 58388227e..5f4fbd8c0 100644 --- a/src/lib/crypto/crc32/crctest.c +++ b/src/lib/crypto/crc32/crctest.c @@ -42,6 +42,7 @@ main() int bad = 0; + outck.length = sizeof(ckout); outck.contents = ckout; while (scanf("%s %s", input, expected_crc) == 2) {