Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153927937
D8133.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
666 B
Referenced Files
None
Subscribers
None
D8133.diff
View Options
Index: lib/libc/stdlib/random.c
===================================================================
--- lib/libc/stdlib/random.c
+++ lib/libc/stdlib/random.c
@@ -270,16 +270,17 @@
srandomdev(void)
{
int mib[2];
- size_t len;
+ size_t expected, len;
if (rand_type == TYPE_0)
- len = sizeof(state[0]);
+ expected = len = sizeof(state[0]);
else
- len = rand_deg * sizeof(state[0]);
+ expected = len = rand_deg * sizeof(state[0]);
mib[0] = CTL_KERN;
mib[1] = KERN_ARND;
- sysctl(mib, 2, state, &len, NULL, 0);
+ if (sysctl(mib, 2, state, &len, NULL, 0) == -1 || len != expected)
+ abort();
if (rand_type != TYPE_0) {
fptr = &state[rand_sep];
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 25, 9:03 PM (16 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32095909
Default Alt Text
D8133.diff (666 B)
Attached To
Mode
D8133: abort in srandomdev if kern.arandom sysctl fails
Attached
Detach File
Event Timeline
Log In to Comment