Browse Source

don't forget to fill in canary bytes for posix_memalign(3); reported by

and ok jeremy@
OPENBSD_6_2
otto 7 years ago
parent
commit
979a770ed0
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      src/lib/libc/stdlib/malloc.c

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

@ -1,4 +1,4 @@
/* $OpenBSD: malloc.c,v 1.222 2017/04/17 16:36:35 otto Exp $ */
/* $OpenBSD: malloc.c,v 1.223 2017/04/18 15:46:44 otto Exp $ */
/* /*
* Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net> * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net>
* Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@ -2018,6 +2018,9 @@ omemalign(struct dir_info *pool, size_t alignment, size_t sz, int zero_fill, voi
else else
memset(p, SOME_JUNK, psz - mopts.malloc_guard); memset(p, SOME_JUNK, psz - mopts.malloc_guard);
} }
else if (mopts.chunk_canaries)
fill_canary(p, sz - mopts.malloc_guard,
psz - mopts.malloc_guard);
return p; return p;
} }


Loading…
Cancel
Save