![]() |
|
Message-ID: <20250324222221.6871-1-contact@hacktivis.me> Date: Mon, 24 Mar 2025 23:22:21 +0100 From: "Haelwenn (lanodan) Monnier" <contact@...ktivis.me> To: musl@...ts.openwall.com Cc: "Haelwenn (lanodan) Monnier" <contact@...ktivis.me> Subject: [PATCH] limits.h: define GETENTROPY_MAX Part of POSIX.1-2024, added at the same time as getentropy() in Issue 1134: https://www.austingroupbugs.net/view.php?id=1134 --- include/limits.h | 1 + src/misc/getentropy.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/limits.h b/include/limits.h index 53a27b9d..c0085080 100644 --- a/include/limits.h +++ b/include/limits.h @@ -84,6 +84,7 @@ #define LINE_MAX 4096 #define RE_DUP_MAX 255 +#define GETENTROPY_MAX 256 #define NL_ARGMAX 9 #define NL_MSGMAX 32767 #define NL_SETMAX 255 diff --git a/src/misc/getentropy.c b/src/misc/getentropy.c index 651ea95f..58004891 100644 --- a/src/misc/getentropy.c +++ b/src/misc/getentropy.c @@ -3,13 +3,14 @@ #include <sys/random.h> #include <pthread.h> #include <errno.h> +#include <limits.h> int getentropy(void *buffer, size_t len) { int cs, ret = 0; char *pos = buffer; - if (len > 256) { + if (len > GETENTROPY_MAX) { errno = EIO; return -1; } -- 2.48.1
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.