summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2006-09-05 16:30:11 +0000
committerru <ru@FreeBSD.org>2006-09-05 16:30:11 +0000
commitcb0ad18d6348487257f2a16b7d4cd232614653ae (patch)
treeef0600928c86bb7645147577c3194345c7834176 /lib
parent32ef6461704b7f6c2cb87663781c3043fc2971e1 (diff)
downloadFreeBSD-src-cb0ad18d6348487257f2a16b7d4cd232614653ae.zip
FreeBSD-src-cb0ad18d6348487257f2a16b7d4cd232614653ae.tar.gz
alloca() cannot check if the allocation is valid; mention the consequences.
Obtained from: OpenBSD
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/alloca.317
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/libc/stdlib/alloca.3 b/lib/libc/stdlib/alloca.3
index e87cd9f..d55cb75 100644
--- a/lib/libc/stdlib/alloca.3
+++ b/lib/libc/stdlib/alloca.3
@@ -32,7 +32,7 @@
.\" @(#)alloca.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd September 5, 2006
.Dt ALLOCA 3
.Os
.Sh NAME
@@ -57,9 +57,6 @@ return.
The
.Fn alloca
function returns a pointer to the beginning of the allocated space.
-If the allocation failed, a
-.Dv NULL
-pointer is returned.
.Sh SEE ALSO
.Xr brk 2 ,
.Xr calloc 3 ,
@@ -81,3 +78,15 @@ The
function
is machine and compiler dependent;
its use is discouraged.
+.Pp
+The
+.Fn alloca
+function is slightly unsafe because it cannot ensure that the pointer
+returned points to a valid and usable block of memory.
+The allocation made may exceed the bounds of the stack, or even go
+further into other objects in memory, and
+.Fn alloca
+cannot determine such an error.
+Avoid
+.Fn alloca
+with large unbounded allocations.
OpenPOWER on IntegriCloud