summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/crypto/arc4random_solaris.h
diff options
context:
space:
mode:
authorbcook <>2016-06-30 12:19:51 +0000
committerbcook <>2016-06-30 12:19:51 +0000
commit5c582f335d85139b8f9481d5b921b9a433277f46 (patch)
treee6cdcf841a28cfc9acea4751b03bc92b4a4a0460 /src/lib/libcrypto/crypto/arc4random_solaris.h
parentfafc8dbf4d3bb9d3105c9575a1536623d00a3eca (diff)
downloadopenbsd-5c582f335d85139b8f9481d5b921b9a433277f46.tar.gz
openbsd-5c582f335d85139b8f9481d5b921b9a433277f46.tar.bz2
openbsd-5c582f335d85139b8f9481d5b921b9a433277f46.zip
Tighten behavior of _rs_allocate failure for portable arc4random implementations.
In the event of a failure in _rs_allocate for rsx, we still have a reference to freed memory for rs on return. Not a huge deal since we subsequently abort in _rs_init, but it looks strange on its own. ok deraadt@
Diffstat (limited to 'src/lib/libcrypto/crypto/arc4random_solaris.h')
-rw-r--r--src/lib/libcrypto/crypto/arc4random_solaris.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/libcrypto/crypto/arc4random_solaris.h b/src/lib/libcrypto/crypto/arc4random_solaris.h
index e8a14afdeb..b1084cda08 100644
--- a/src/lib/libcrypto/crypto/arc4random_solaris.h
+++ b/src/lib/libcrypto/crypto/arc4random_solaris.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: arc4random_solaris.h,v 1.9 2015/01/15 06:57:18 deraadt Exp $ */ 1/* $OpenBSD: arc4random_solaris.h,v 1.10 2016/06/30 12:19:51 bcook Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, David Mazieres <dm@uun.org> 4 * Copyright (c) 1996, David Mazieres <dm@uun.org>
@@ -72,6 +72,7 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
72 if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE, 72 if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
73 MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { 73 MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
74 munmap(*rsp, sizeof(**rsp)); 74 munmap(*rsp, sizeof(**rsp));
75 *rsp = NULL;
75 return (-1); 76 return (-1);
76 } 77 }
77 78