From d39bbf5a844c1b9fc5e299f91bfe5457866ed544 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 22 Jun 2001 03:28:46 +0000 Subject: [PATCH] * destest.c (value): Now signed int, since some entries are negative. (convert): Do bounds checking on character values used as indices into value array. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13477 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/des/ChangeLog | 5 +++++ src/lib/crypto/des/destest.c | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index c16658a00..01330958d 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,5 +1,10 @@ 2001-06-21 Ken Raeburn + * destest.c (value): Now signed int, since some entries are + negative. + (convert): Do bounds checking on character values used as indices + into value array. + * string2key.c (mit_des_string_to_key_int): Now static. 2001-06-21 Ezra Peisach diff --git a/src/lib/crypto/des/destest.c b/src/lib/crypto/des/destest.c index fcddc49d6..0995b08bb 100644 --- a/src/lib/crypto/des/destest.c +++ b/src/lib/crypto/des/destest.c @@ -67,8 +67,8 @@ krb5_octet zeroblock[8] = {0,0,0,0,0,0,0,0}; int main(argc, argv) -int argc; -char *argv[]; + int argc; + char *argv[]; { char block1[17], block2[17], block3[17]; @@ -127,7 +127,7 @@ char *argv[]; exit( (error > 256 && error % 256) ? 1 : error); } -unsigned int value[128] = { +int value[128] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -148,11 +148,13 @@ unsigned int value[128] = { void convert(text, cblock) -char *text; -unsigned char cblock[]; + char *text; + unsigned char cblock[]; { register int i; for (i = 0; i < 8; i++) { + if (text[i*2] < 0 || text[i*2] >= 128) + abort (); if (value[(int) text[i*2]] == -1 || value[(int) text[i*2+1]] == -1) { printf("Bad value byte %d in %s\n", i, text); exit(1); -- 2.26.2