Browse Source

if somebody makes the mistake of disabling abort, don't deref null in

validate_junk. from Michal Mazurek
OPENBSD_5_9
tedu 9 years ago
parent
commit
57beaad82f
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      src/lib/libc/stdlib/malloc.c

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

@ -1,4 +1,4 @@
/* $OpenBSD: malloc.c,v 1.177 2015/12/09 02:45:23 tedu Exp $ */
/* $OpenBSD: malloc.c,v 1.178 2015/12/30 06:01:18 tedu Exp $ */
/*
* Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net>
* Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@ -1225,8 +1225,10 @@ validate_junk(void *p) {
if (p == NULL)
return;
r = find(pool, p);
if (r == NULL)
if (r == NULL) {
wrterror("bogus pointer in validate_junk", p);
return;
}
REALSIZE(sz, r);
if (sz > 0 && sz <= MALLOC_MAXCHUNK)
sz -= mopts.malloc_canaries;


Loading…
Cancel
Save