diff options
author | 2014-05-06 16:06:33 +0000 | |
---|---|---|
committer | 2014-05-06 16:06:33 +0000 | |
commit | 0dc651d67b499fdda9127d6f804f9a8da770841c (patch) | |
tree | ec828f1578681c5714591e717067e0a232748a17 /lib/libc/crypt/arc4random.c | |
parent | fix stupid commit (diff) | |
download | wireguard-openbsd-0dc651d67b499fdda9127d6f804f9a8da770841c.tar.xz wireguard-openbsd-0dc651d67b499fdda9127d6f804f9a8da770841c.zip |
missing NULL checks to see if init is needed. found hard way by deraadt.
Diffstat (limited to 'lib/libc/crypt/arc4random.c')
-rw-r--r-- | lib/libc/crypt/arc4random.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/crypt/arc4random.c b/lib/libc/crypt/arc4random.c index 57decde1f81..7ff1495fc46 100644 --- a/lib/libc/crypt/arc4random.c +++ b/lib/libc/crypt/arc4random.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random.c,v 1.29 2014/05/06 15:37:57 tedu Exp $ */ +/* $OpenBSD: arc4random.c,v 1.30 2014/05/06 16:06:33 tedu Exp $ */ /* * Copyright (c) 1996, David Mazieres <dm@uun.org> @@ -63,10 +63,10 @@ _rs_init(u_char *buf, size_t n) if (n < KEYSZ + IVSZ) return; - if ((rs = mmap(NULL, sizeof(*rs), PROT_READ|PROT_WRITE, + if (rs == NULL && (rs = mmap(NULL, sizeof(*rs), PROT_READ|PROT_WRITE, MAP_ANON, -1, 0)) == MAP_FAILED) abort(); - if ((rs_buf = mmap(NULL, RSBUFSZ, PROT_READ|PROT_WRITE, + if (rs_buf == NULL && (rs_buf = mmap(NULL, RSBUFSZ, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0)) == MAP_FAILED) abort(); |