Browse Source

munmap correct object in (extremely unlikely, and effectively terminal)

case of failing to map the 2nd object.
found by Paul Maurers
OPENBSD_5_7
deraadt 10 years ago
parent
commit
26dc53b975
6 changed files with 12 additions and 12 deletions
  1. +2
    -2
      src/lib/libcrypto/arc4random/arc4random_linux.h
  2. +2
    -2
      src/lib/libcrypto/arc4random/arc4random_osx.h
  3. +2
    -2
      src/lib/libcrypto/arc4random/arc4random_solaris.h
  4. +2
    -2
      src/lib/libcrypto/crypto/arc4random_linux.h
  5. +2
    -2
      src/lib/libcrypto/crypto/arc4random_osx.h
  6. +2
    -2
      src/lib/libcrypto/crypto/arc4random_solaris.h

+ 2
- 2
src/lib/libcrypto/arc4random/arc4random_linux.h View File

@ -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> * 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, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsxp, sizeof(**rsxp));
munmap(*rsp, sizeof(**rsp));
return (-1); return (-1);
} }


+ 2
- 2
src/lib/libcrypto/arc4random/arc4random_osx.h View File

@ -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> * 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, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsxp, sizeof(**rsxp));
munmap(*rsp, sizeof(**rsp));
return -1; return -1;
} }


+ 2
- 2
src/lib/libcrypto/arc4random/arc4random_solaris.h View File

@ -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> * 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, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsxp, sizeof(**rsxp));
munmap(*rsp, sizeof(**rsp));
return (-1); return (-1);
} }


+ 2
- 2
src/lib/libcrypto/crypto/arc4random_linux.h View File

@ -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> * 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, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsxp, sizeof(**rsxp));
munmap(*rsp, sizeof(**rsp));
return (-1); return (-1);
} }


+ 2
- 2
src/lib/libcrypto/crypto/arc4random_osx.h View File

@ -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> * 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, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsxp, sizeof(**rsxp));
munmap(*rsp, sizeof(**rsp));
return -1; return -1;
} }


+ 2
- 2
src/lib/libcrypto/crypto/arc4random_solaris.h View File

@ -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> * 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, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsxp, sizeof(**rsxp));
munmap(*rsp, sizeof(**rsp));
return (-1); return (-1);
} }


Loading…
Cancel
Save