Browse Source

Check mmap return value against MAP_FAILED not NULL.

Okay deraadt@, otto@.
OPENBSD_4_7
pirofti 15 years ago
parent
commit
5e4aca2f5f
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/lib/libc/stdlib/malloc.c

+ 2
- 2
src/lib/libc/stdlib/malloc.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: malloc.c,v 1.116 2009/06/08 19:21:08 deraadt Exp $ */
/* $OpenBSD: malloc.c,v 1.117 2009/10/20 21:19:37 pirofti Exp $ */
/* /*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
* *
@ -696,7 +696,7 @@ omalloc_init(struct dir_info **dp)
* randomise offset inside the page at which the dir_info * randomise offset inside the page at which the dir_info
* lies (subject to alignment by 1 << MALLOC_MINSHIFT) * lies (subject to alignment by 1 << MALLOC_MINSHIFT)
*/ */
if ((p = MMAP(DIR_INFO_RSZ + (MALLOC_PAGESIZE * 2))) == NULL)
if ((p = MMAP(DIR_INFO_RSZ + (MALLOC_PAGESIZE * 2))) == MAP_FAILED)
return -1; return -1;
mprotect(p, MALLOC_PAGESIZE, PROT_NONE); mprotect(p, MALLOC_PAGESIZE, PROT_NONE);
mprotect(p + MALLOC_PAGESIZE + DIR_INFO_RSZ, mprotect(p + MALLOC_PAGESIZE + DIR_INFO_RSZ,


Loading…
Cancel
Save