From 5c582f335d85139b8f9481d5b921b9a433277f46 Mon Sep 17 00:00:00 2001 From: bcook <> Date: Thu, 30 Jun 2016 12:19:51 +0000 Subject: 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@ --- src/lib/libcrypto/crypto/arc4random_solaris.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib/libcrypto/crypto/arc4random_solaris.h') 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 @@ -/* $OpenBSD: arc4random_solaris.h,v 1.9 2015/01/15 06:57:18 deraadt Exp $ */ +/* $OpenBSD: arc4random_solaris.h,v 1.10 2016/06/30 12:19:51 bcook Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -72,6 +72,7 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp) if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { munmap(*rsp, sizeof(**rsp)); + *rsp = NULL; return (-1); } -- cgit v1.2.3-55-g6feb