diff options
author | Geoff Thorpe <geoff@openssl.org> | 2004-04-21 17:08:56 +0200 |
---|---|---|
committer | Geoff Thorpe <geoff@openssl.org> | 2004-04-21 17:08:56 +0200 |
commit | 8c521c7a34eb8852ef2e7ae174342896fa362378 (patch) | |
tree | ba19c1ea57e7cdef61b96800e5ab8287b865e3d2 /crypto/stack/stack.c | |
parent | New option to 'x509' -next_serial. This outputs the certificate (diff) | |
download | openssl-8c521c7a34eb8852ef2e7ae174342896fa362378.tar.xz openssl-8c521c7a34eb8852ef2e7ae174342896fa362378.zip |
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.
Diffstat (limited to 'crypto/stack/stack.c')
-rw-r--r-- | crypto/stack/stack.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c index 821b6caca5..9cc0a82962 100644 --- a/crypto/stack/stack.c +++ b/crypto/stack/stack.c @@ -192,8 +192,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) @@ -313,7 +312,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); } |