From: Geoff Thorpe Date: Fri, 2 Apr 2004 06:25:53 +0000 (+0000) Subject: Avoid undefined results when the parameter is out of range. X-Git-Tag: OpenSSL_0_9_7e~132 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ef7a1b3de9451b8b3b171603a897f5d2f3ac14f;p=openssl Avoid undefined results when the parameter is out of range. --- diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c index 2496f28a8c..ff6d14a86c 100644 --- a/crypto/stack/stack.c +++ b/crypto/stack/stack.c @@ -306,7 +306,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]; }