Skip to content

Commit

Permalink
Fix memset call in stack.c
Browse files Browse the repository at this point in the history
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 7132ac8)
  • Loading branch information
mattcaswell committed Mar 17, 2015
1 parent d3554bf commit f4b8760
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/stack/stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit f4b8760

Please sign in to comment.