From bb18d1ab176e70be6006c1a6d52c6a6d941d0f2e Mon Sep 17 00:00:00 2001 From: erana Date: Fri, 20 Jan 2012 18:18:43 +0900 Subject: [PATCH] blowfish fixes - 8 --- scsh/encryption/dictionary.scm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scsh/encryption/dictionary.scm b/scsh/encryption/dictionary.scm index 9cd70d0..1747b8a 100644 --- a/scsh/encryption/dictionary.scm +++ b/scsh/encryption/dictionary.scm @@ -37,11 +37,14 @@ )) (define (ref-with-index i) ;; get key - (do ((j 0 (+ j 1)) - (l *dict (cdr l))) - ((= j i) - (car l));;returns value - )) + (if (>= i (length *dict)) + (begin (display "dictionary - index out of range") + 0) + (do ((j 0 (+ j 1)) + (l *dict (cdr l))) + ((= j i) + (car l));;returns value + ))) (define (set-with-index i value) ;; set value (do ((j 0 (+ j 1))