Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147511988
D47689.id146764.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D47689.id146764.diff
View Options
Index: include/limits.h
===================================================================
--- include/limits.h
+++ include/limits.h
@@ -137,6 +137,10 @@
#define MB_LEN_MAX 6 /* 31-bit UTF-8 */
+#if __POSIX_VISIBLE >= 202405
+#define GETENTROPY_MAX 256
+#endif
+
#include <sys/limits.h>
#if __POSIX_VISIBLE
Index: lib/libc/gen/getentropy.3
===================================================================
--- lib/libc/gen/getentropy.3
+++ lib/libc/gen/getentropy.3
@@ -60,8 +60,8 @@
.Fa buf
parameter points to an
invalid address.
-.It Bq Er EIO
-Too many bytes requested, or some other fatal error occurred.
+.It Bq Er EINVAL
+Too many bytes requested.
.El
.Sh SEE ALSO
.Xr getrandom 2 ,
@@ -69,7 +69,7 @@
.Xr random 4
.Sh STANDARDS
.Fn getentropy
-nearly conforms to
+conforms to
.St -p1003.1-2024 .
.Sh HISTORY
The
@@ -80,9 +80,3 @@
.Fx
libc compatibility shim first appeared in
.Fx 12.0 .
-.Sh BUGS
-.In limits.h
-does not define
-.Dv GETENTROPY_MAX .
-Some error values do not match
-.St -p1003.1-2024 .
Index: lib/libc/gen/getentropy.c
===================================================================
--- lib/libc/gen/getentropy.c
+++ lib/libc/gen/getentropy.c
@@ -30,6 +30,7 @@
#include <sys/random.h>
#include <errno.h>
+#include <limits.h>
#include <signal.h>
#include <ssp/ssp.h>
@@ -46,8 +47,8 @@
{
ssize_t rd;
- if (buflen > 256) {
- errno = EIO;
+ if (buflen > GETENTROPY_MAX) {
+ errno = EINVAL;
return (-1);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 12, 1:25 PM (2 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29584515
Default Alt Text
D47689.id146764.diff (1 KB)
Attached To
Mode
D47689: libc: Fix getentropy POSIX 2024 conformance issues
Attached
Detach File
Event Timeline
Log In to Comment