diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-08-13 06:04:11 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-08-13 06:04:11 +0000 |
commit | 815129c13b1320e26866cb45ee01901403c5afcd (patch) | |
tree | 13db5f3cb07d0eae5d7d74fb8a3b304d07a67e64 | |
parent | 97faf22827cb0a40243bd81e90aab6b82d6c6830 (diff) |
munmap correct object in (extremely unlikely, and effectively terminal)
case of failing to map the 2nd object.
found by Paul Maurers
-rw-r--r-- | lib/libcrypto/arc4random/arc4random_linux.h | 4 | ||||
-rw-r--r-- | lib/libcrypto/arc4random/arc4random_osx.h | 4 | ||||
-rw-r--r-- | lib/libcrypto/arc4random/arc4random_solaris.h | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/libcrypto/arc4random/arc4random_linux.h b/lib/libcrypto/arc4random/arc4random_linux.h index 7acba3f78e5..123525f2f13 100644 --- a/lib/libcrypto/arc4random/arc4random_linux.h +++ b/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 <dm@uun.org> @@ -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/lib/libcrypto/arc4random/arc4random_osx.h b/lib/libcrypto/arc4random/arc4random_osx.h index c14e044fe26..32cbccd1edc 100644 --- a/lib/libcrypto/arc4random/arc4random_osx.h +++ b/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 <dm@uun.org> @@ -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/lib/libcrypto/arc4random/arc4random_solaris.h b/lib/libcrypto/arc4random/arc4random_solaris.h index 2082a4728f5..a0385ce1544 100644 --- a/lib/libcrypto/arc4random/arc4random_solaris.h +++ b/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 <dm@uun.org> @@ -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); } |