From 2749276b95952d3898bc3b64373ade78a8f84fb7 Mon Sep 17 00:00:00 2001 From: Geoff Thorpe Date: Fri, 2 Apr 2004 06:25:11 +0000 Subject: [PATCH] Avoid undefined results when the parameter is out of range. --- crypto/stack/stack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c index 1d2b47ee67..821b6caca5 100644 --- a/crypto/stack/stack.c +++ b/crypto/stack/stack.c @@ -307,7 +307,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]; } -- 2.25.1