summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/buffer/buffer.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2014-06-01 15:10:53 +0000
committerderaadt <deraadt@openbsd.org>2014-06-01 15:10:53 +0000
commit07519e1f4c7cbe5b6fb9813fc4ec04ca8957575a (patch)
tree67417aff68e467b4bd8f93302069d2f250764d1d /lib/libcrypto/buffer/buffer.c
parentBuild with WARNINGS=Yes and Werror. (diff)
downloadwireguard-openbsd-07519e1f4c7cbe5b6fb9813fc4ec04ca8957575a.tar.xz
wireguard-openbsd-07519e1f4c7cbe5b6fb9813fc4ec04ca8957575a.zip
Commit this before the head-scratching leads to premature baldness:
memset(a->data, 0, (unsigned int)a->max); but the decl is: size_t max; size_t could be larger than int, especially in some of the systems OpenSSL purports to support. How do _intentionally truncating_ casts like enter into a codebase? Lack of understanding of C, at a minimum. Generally the objects are small, but this code is _intentionally unready_ for large objects. ok miod
Diffstat (limited to 'lib/libcrypto/buffer/buffer.c')
-rw-r--r--lib/libcrypto/buffer/buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libcrypto/buffer/buffer.c b/lib/libcrypto/buffer/buffer.c
index 486d6fef141..71784693be3 100644
--- a/lib/libcrypto/buffer/buffer.c
+++ b/lib/libcrypto/buffer/buffer.c
@@ -88,7 +88,7 @@ BUF_MEM_free(BUF_MEM *a)
return;
if (a->data != NULL) {
- memset(a->data, 0, (unsigned int)a->max);
+ memset(a->data, 0, a->max);
free(a->data);
}
free(a);