]> granicus.if.org Git - openssl/commitdiff
Fix memset call in stack.c
authorMatt Caswell <matt@openssl.org>
Thu, 12 Mar 2015 12:54:44 +0000 (12:54 +0000)
committerMatt Caswell <matt@openssl.org>
Tue, 17 Mar 2015 13:39:53 +0000 (13:39 +0000)
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 <levitte@openssl.org>
crypto/stack/stack.c

index 1b89f551f1559e4e05940ecf5bb667269285ad10..7d97c2cbb41c29022960a6b36db2a33e83e03646 100644 (file)
@@ -299,7 +299,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;
 }