From 7e48f3211348f600c8cbaa4982a03febd41fe1de Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Thu, 6 Dec 2001 04:21:27 +0000 Subject: [PATCH] alloca cannot check if the allocation is valid. mention the consequences; millert ok --- src/lib/libc/stdlib/alloca.3 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/lib/libc/stdlib/alloca.3 b/src/lib/libc/stdlib/alloca.3 index e9e0b67e..431443a6 100644 --- a/src/lib/libc/stdlib/alloca.3 +++ b/src/lib/libc/stdlib/alloca.3 @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: alloca.3,v 1.8 2000/04/20 13:50:01 aaron Exp $ +.\" $OpenBSD: alloca.3,v 1.9 2001/12/06 04:21:27 deraadt Exp $ .\" .Dd May 2, 1991 .Dt ALLOCA 3 @@ -70,3 +70,15 @@ function is machine dependent; its use is discouraged. .\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd .\" The first man page (or link to a man page that I can find at the .\" moment is 4.3... +.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.