From: Matt Caswell Date: Thu, 12 Mar 2015 12:54:44 +0000 (+0000) Subject: Fix memset call in stack.c X-Git-Tag: OpenSSL_1_0_2a~23 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b2b81639640e84046cdd5d869009eacef22448f5;p=oweals%2Fopenssl.git Fix memset call in stack.c The function sk_zero is supposed to zero the elements held within a stack. It uses memset to do this. However it calculates the size of each element as being sizeof(char **) instead of sizeof(char *). This probably doesn't make much practical difference in most cases, but isn't a portable assumption. Reviewed-by: Richard Levitte (cherry picked from commit 7132ac830fa08d9a936e011d7c541b0c52115b33) --- diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c index 47457c722d..de437acf6a 100644 --- a/crypto/stack/stack.c +++ b/crypto/stack/stack.c @@ -312,7 +312,7 @@ void sk_zero(_STACK *st) return; if (st->num <= 0) return; - memset((char *)st->data, 0, sizeof(st->data) * st->num); + memset((char *)st->data, 0, sizeof(*st->data) * st->num); st->num = 0; }