svn commit: r306713 - in user/alc/PQ_LAUNDRY: lib/libc/stdlib lib/msun/ld80 lib/msun/src sys/cam sys/vm

Philip M. Gollucci pgollucci at p6m7g8.com
Wed Oct 5 22:34:11 UTC 2016


I know you(Alan) didn't write this, its from the MFH, but how would len !=
expected.

neither are initialized or passed in
both times its set its expected = len = foo


On Wed, Oct 5, 2016 at 2:03 PM, Alan Cox <alc at freebsd.org> wrote:

> Modified: user/alc/PQ_LAUNDRY/lib/libc/stdlib/random.c
> ============================================================
> ==================
> --- user/alc/PQ_LAUNDRY/lib/libc/stdlib/random.c        Wed Oct  5
> 17:32:06 2016        (r306712)
> +++ user/alc/PQ_LAUNDRY/lib/libc/stdlib/random.c        Wed Oct  5
> 18:03:17 2016        (r306713)
> @@ -270,16 +270,17 @@ void
>  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];
>




-- 
---------------------------------------------------------------------------------
4096R/D21D2752
<http://pgp.mit.edu/pks/lookup?op=get&search=0xF699A450D21D2752> ECDF B597
B54B 7F92 753E  E0EA F699 A450 D21D 2752
Philip M. Gollucci (pgollucci at p6m7g8.com) c: 703.336.9354
Member,                           Apache Software Foundation
Committer,                        FreeBSD Foundation
Consultant,                       P6M7G8 Inc.
Director Cloud Technology,        Capital One

What doesn't kill us can only make us stronger;
Except it almost kills you.


More information about the svn-src-user mailing list