]> 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:49:31 +0000 (13:49 +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>
(cherry picked from commit 7132ac830fa08d9a936e011d7c541b0c52115b33)

crypto/stack/stack.c

index fbe9d6e756b57378883f1dcbe6a7a859c22f2b55..331f907190f7b278d7bc7972839b65c113eea806 100644 (file)
@@ -278,7 +278,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;
 }