summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/malloc.3
diff options
context:
space:
mode:
authortdeval <tdeval@openbsd.org>2001-10-30 17:01:07 +0000
committertdeval <tdeval@openbsd.org>2001-10-30 17:01:07 +0000
commita2440a82cd4803f90b2b454ec7a08ae5abf124b6 (patch)
treec73de485ebe5d3636f5979bf400fa7b2ed9afb50 /lib/libc/stdlib/malloc.3
parentcorrect realloc() misuse (diff)
downloadwireguard-openbsd-a2440a82cd4803f90b2b454ec7a08ae5abf124b6.tar.xz
wireguard-openbsd-a2440a82cd4803f90b2b454ec7a08ae5abf124b6.zip
mprotect allocations sized at 0 bytes. This will cause a fault for access
to such, permitting them to be discovered, instead of exploited as the ssh crc insertion detector was. Idea by theo, written by tdeval.
Diffstat (limited to 'lib/libc/stdlib/malloc.3')
-rw-r--r--lib/libc/stdlib/malloc.34
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3
index e65668566e6..2f7e0c61b52 100644
--- a/lib/libc/stdlib/malloc.3
+++ b/lib/libc/stdlib/malloc.3
@@ -34,7 +34,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: malloc.3,v 1.20 2000/10/25 15:23:15 aaron Exp $
+.\" $OpenBSD: malloc.3,v 1.21 2001/10/30 17:01:07 tdeval Exp $
.\"
.Dd August 27, 1996
.Dt MALLOC 3
@@ -79,6 +79,8 @@ If the space is of
or larger, the memory returned will be page-aligned.
.Pp
Allocation of a zero size object returns a pointer to a zero size object.
+This zero size object is access protected, so any access to it will
+generate an exception (SIGSEGV)
.Pp
The
.Fn calloc