2001-06-21 Ken Raeburn <raeburn@mit.edu>
+ * 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 <epeisach@mit.edu>
int
main(argc, argv)
-int argc;
-char *argv[];
+ int argc;
+ char *argv[];
{
char block1[17], block2[17], block3[17];
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,
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);