Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowi@redhat.com>2017-03-11 12:01:47 +0300
committerCorinna Vinschen <corinna@vinschen.de>2017-03-11 12:03:29 +0300
commit6c420fa49455a7f743c01190e1d23b0749e20fa6 (patch)
tree73f0f333ce4acd43f3e589bb1b0c7f41bb6a210e /winsup
parentc9e4b69e9f48a517ec5c6bbf20c80bd744117b14 (diff)
getrandom: it's MIN, not MAX
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/libc/getentropy.cc2
-rw-r--r--winsup/cygwin/release/2.8.02
2 files changed, 3 insertions, 1 deletions
diff --git a/winsup/cygwin/libc/getentropy.cc b/winsup/cygwin/libc/getentropy.cc
index 5918eb5d9..c358b5287 100644
--- a/winsup/cygwin/libc/getentropy.cc
+++ b/winsup/cygwin/libc/getentropy.cc
@@ -51,7 +51,7 @@ getrandom (void *ptr, size_t len, unsigned int flags)
return -1;
}
/* Max. bytes returned by Linux call. */
- len = MAX (len, (flags & GRND_RANDOM) ? 512 : 33554431);
+ len = MIN (len, (flags & GRND_RANDOM) ? 512 : 33554431);
__try
{
if (!RtlGenRandom (ptr, len))
diff --git a/winsup/cygwin/release/2.8.0 b/winsup/cygwin/release/2.8.0
index d8e20a1c9..f5568deec 100644
--- a/winsup/cygwin/release/2.8.0
+++ b/winsup/cygwin/release/2.8.0
@@ -23,3 +23,5 @@ Bug Fixes
- Fix a few problems which are the combined culprit of fork failing
when called recursively from a pthread.
Addresses: https://cygwin.com/ml/cygwin/2017-03/msg00113.html
+
+- Fix potential buffer overflow in getrandom.