diff options
Diffstat (limited to 'crypto/stack')
-rw-r--r-- | crypto/stack/stack.c | 18 | ||||
-rw-r--r-- | crypto/stack/stack.h | 6 |
2 files changed, 16 insertions, 8 deletions
diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c index 712089ef31..610ccbb756 100644 --- a/crypto/stack/stack.c +++ b/crypto/stack/stack.c @@ -1,5 +1,5 @@ /* crypto/stack/stack.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written @@ -72,7 +72,7 @@ #undef MIN_NODES #define MIN_NODES 4 -char *STACK_version="STACK part of SSLeay 0.8.1b 29-Jun-1998"; +char *STACK_version="STACK part of SSLeay 0.9.0b 29-Jun-1998"; #ifndef NOPROTO #define FP_ICC (int (*)(const void *,const void *)) @@ -193,14 +193,22 @@ STACK *st; int loc; { char *ret; + int i,j; if ((st->num == 0) || (loc < 0) || (loc >= st->num)) return(NULL); ret=st->data[loc]; if (loc != st->num-1) - memcpy( &(st->data[loc]), - &(st->data[loc+1]), - sizeof(char *)*(st->num-loc-1)); + { + j=st->num-1; + for (i=loc; i<j; i++) + st->data[i]=st->data[i+1]; + /* In theory memcpy is not safe for this + * memcpy( &(st->data[loc]), + * &(st->data[loc+1]), + * sizeof(char *)*(st->num-loc-1)); + */ + } st->num--; return(ret); } diff --git a/crypto/stack/stack.h b/crypto/stack/stack.h index 66ba83ec40..615eb6ff94 100644 --- a/crypto/stack/stack.h +++ b/crypto/stack/stack.h @@ -1,5 +1,5 @@ /* crypto/stack/stack.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written @@ -73,8 +73,8 @@ typedef struct stack_st int (*comp)(); } STACK; -#define sk_num(sk) ((sk)->num) -#define sk_value(sk,n) ((sk)->data[n]) +#define sk_num(sk) ((sk)->num) +#define sk_value(sk,n) ((sk)->data[n]) #define sk_new_null() sk_new(NULL) #ifndef NOPROTO |