Browse Source

alloca cannot check if the allocation is valid. mention the consequences; millert ok

OPENBSD_3_1
deraadt 23 years ago
parent
commit
7e48f32113
1 changed files with 13 additions and 1 deletions
  1. +13
    -1
      src/lib/libc/stdlib/alloca.3

+ 13
- 1
src/lib/libc/stdlib/alloca.3 View File

@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" 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 .Dd May 2, 1991
.Dt ALLOCA 3 .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 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 .\" The first man page (or link to a man page that I can find at the
.\" moment is 4.3... .\" 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.

Loading…
Cancel
Save