diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c index 02857f0446..7877b15a4f 100644 --- a/crypto/stack/stack.c +++ b/crypto/stack/stack.c @@ -304,7 +304,7 @@ int sk_num(const STACK *st) char *sk_value(const STACK *st, int i) { - if(st == NULL) return NULL; + if(!st || (i < 0) || (i >= st->num)) return NULL; return st->data[i]; }