Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/stdlib note that alloca can't report error.



details:   https://anonhg.NetBSD.org/src/rev/4f919fd8db13
branches:  trunk
changeset: 535114:4f919fd8db13
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sat Aug 10 16:55:18 2002 +0000

description:
note that alloca can't report error.
from OpenBSD.

diffstat:

 lib/libc/stdlib/alloca.3 |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 0d99889d5c60 -r 4f919fd8db13 lib/libc/stdlib/alloca.3
--- a/lib/libc/stdlib/alloca.3  Sat Aug 10 16:51:26 2002 +0000
+++ b/lib/libc/stdlib/alloca.3  Sat Aug 10 16:55:18 2002 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: alloca.3,v 1.9 2002/02/07 07:00:27 ross Exp $
+.\"    $NetBSD: alloca.3,v 1.10 2002/08/10 16:55:18 yamt Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\"     from: @(#)alloca.3     8.1 (Berkeley) 6/4/93
 .\"
-.Dd June 4, 1993
+.Dd August 11, 2002
 .Dt ALLOCA 3
 .Os
 .Sh NAME
@@ -72,6 +72,18 @@
 .Fn alloca
 function
 is machine 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.
 .\" .Sh HISTORY
 .\" The
 .\" .Fn alloca



Home | Main Index | Thread Index | Old Index