From: Geoff Thorpe Date: Wed, 21 Apr 2004 15:09:52 +0000 (+0000) Subject: Extend the index parameter checking from sk_value to sk_set(). Also tidy up X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1c27ce4e7040e52ad9c8df6446cc345e16d5076e;p=oweals%2Fopenssl.git Extend the index parameter checking from sk_value to sk_set(). Also tidy up some similar code elsewhere. Thanks to Francesco Petruzzi for bringing this to my attention. --- diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c index 7877b15a4f..108ecb6eaf 100644 --- a/crypto/stack/stack.c +++ b/crypto/stack/stack.c @@ -189,8 +189,7 @@ char *sk_delete(STACK *st, int loc) char *ret; int i,j; - if ((st == NULL) || (st->num == 0) || (loc < 0) - || (loc >= st->num)) return(NULL); + if(!st || (loc < 0) || (loc >= st->num)) return NULL; ret=st->data[loc]; if (loc != st->num-1) @@ -310,7 +309,7 @@ char *sk_value(const STACK *st, int i) char *sk_set(STACK *st, int i, char *value) { - if(st == NULL) return NULL; + if(!st || (i < 0) || (i >= st->num)) return NULL; return (st->data[i] = value); }