From 26dc53b975aa478b5cc2c019f5e7695d15eaa7d8 Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Wed, 13 Aug 2014 06:04:10 +0000 Subject: [PATCH] munmap correct object in (extremely unlikely, and effectively terminal) case of failing to map the 2nd object. found by Paul Maurers --- src/lib/libcrypto/arc4random/arc4random_linux.h | 4 ++-- src/lib/libcrypto/arc4random/arc4random_osx.h | 4 ++-- src/lib/libcrypto/arc4random/arc4random_solaris.h | 4 ++-- src/lib/libcrypto/crypto/arc4random_linux.h | 4 ++-- src/lib/libcrypto/crypto/arc4random_osx.h | 4 ++-- src/lib/libcrypto/crypto/arc4random_solaris.h | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lib/libcrypto/arc4random/arc4random_linux.h b/src/lib/libcrypto/arc4random/arc4random_linux.h index 7acba3f7..123525f2 100644 --- a/src/lib/libcrypto/arc4random/arc4random_linux.h +++ b/src/lib/libcrypto/arc4random/arc4random_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_linux.h,v 1.7 2014/07/20 20:51:13 bcook Exp $ */ +/* $OpenBSD: arc4random_linux.h,v 1.8 2014/08/13 06:04:10 deraadt Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -76,7 +76,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(*rsxp, sizeof(**rsxp)); + munmap(*rsp, sizeof(**rsp)); return (-1); } diff --git a/src/lib/libcrypto/arc4random/arc4random_osx.h b/src/lib/libcrypto/arc4random/arc4random_osx.h index c14e044f..32cbccd1 100644 --- a/src/lib/libcrypto/arc4random/arc4random_osx.h +++ b/src/lib/libcrypto/arc4random/arc4random_osx.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_osx.h,v 1.7 2014/07/20 20:51:13 bcook Exp $ */ +/* $OpenBSD: arc4random_osx.h,v 1.8 2014/08/13 06:04:10 deraadt Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -70,7 +70,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(*rsxp, sizeof(**rsxp)); + munmap(*rsp, sizeof(**rsp)); return -1; } diff --git a/src/lib/libcrypto/arc4random/arc4random_solaris.h b/src/lib/libcrypto/arc4random/arc4random_solaris.h index 2082a472..a0385ce1 100644 --- a/src/lib/libcrypto/arc4random/arc4random_solaris.h +++ b/src/lib/libcrypto/arc4random/arc4random_solaris.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_solaris.h,v 1.7 2014/07/20 20:51:13 bcook Exp $ */ +/* $OpenBSD: arc4random_solaris.h,v 1.8 2014/08/13 06:04:10 deraadt Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -70,7 +70,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(*rsxp, sizeof(**rsxp)); + munmap(*rsp, sizeof(**rsp)); return (-1); } diff --git a/src/lib/libcrypto/crypto/arc4random_linux.h b/src/lib/libcrypto/crypto/arc4random_linux.h index 7acba3f7..123525f2 100644 --- a/src/lib/libcrypto/crypto/arc4random_linux.h +++ b/src/lib/libcrypto/crypto/arc4random_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_linux.h,v 1.7 2014/07/20 20:51:13 bcook Exp $ */ +/* $OpenBSD: arc4random_linux.h,v 1.8 2014/08/13 06:04:10 deraadt Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -76,7 +76,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(*rsxp, sizeof(**rsxp)); + munmap(*rsp, sizeof(**rsp)); return (-1); } diff --git a/src/lib/libcrypto/crypto/arc4random_osx.h b/src/lib/libcrypto/crypto/arc4random_osx.h index c14e044f..32cbccd1 100644 --- a/src/lib/libcrypto/crypto/arc4random_osx.h +++ b/src/lib/libcrypto/crypto/arc4random_osx.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_osx.h,v 1.7 2014/07/20 20:51:13 bcook Exp $ */ +/* $OpenBSD: arc4random_osx.h,v 1.8 2014/08/13 06:04:10 deraadt Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -70,7 +70,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(*rsxp, sizeof(**rsxp)); + munmap(*rsp, sizeof(**rsp)); return -1; } diff --git a/src/lib/libcrypto/crypto/arc4random_solaris.h b/src/lib/libcrypto/crypto/arc4random_solaris.h index 2082a472..a0385ce1 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.7 2014/07/20 20:51:13 bcook Exp $ */ +/* $OpenBSD: arc4random_solaris.h,v 1.8 2014/08/13 06:04:10 deraadt Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -70,7 +70,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(*rsxp, sizeof(**rsxp)); + munmap(*rsp, sizeof(**rsp)); return (-1); }