diff options
author | Damien Miller <djm@mindrot.org> | 2006-03-26 14:19:21 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2006-03-26 14:19:21 +1100 |
commit | 07d86bec5eeaf19fe33dca99c8ebcbe9a77c3938 (patch) | |
tree | 098295eee2d7ec7b116b0db3ac4b580713dd5ab0 /xmalloc.h | |
parent | 7cd4579eb3c5afd22ae24436fd2611cd3aa0150a (diff) |
- djm@cvs.openbsd.org 2006/03/25 00:05:41
[auth-bsdauth.c auth-skey.c auth.c auth2-chall.c channels.c]
[clientloop.c deattack.c gss-genr.c kex.c key.c misc.c moduli.c]
[monitor.c monitor_wrap.c packet.c scard.c sftp-server.c ssh-agent.c]
[ssh-keyscan.c ssh.c sshconnect.c sshconnect2.c sshd.c uuencode.c]
[xmalloc.c xmalloc.h]
introduce xcalloc() and xasprintf() failure-checked allocations
functions and use them throughout openssh
xcalloc is particularly important because malloc(nmemb * size) is a
dangerous idiom (subject to integer overflow) and it is time for it
to die
feedback and ok deraadt@
Diffstat (limited to 'xmalloc.h')
-rw-r--r-- | xmalloc.h | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: xmalloc.h,v 1.9 2002/06/19 00:27:55 deraadt Exp $ */ | 1 | /* $OpenBSD: xmalloc.h,v 1.10 2006/03/25 00:05:41 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -20,8 +20,12 @@ | |||
20 | #define XMALLOC_H | 20 | #define XMALLOC_H |
21 | 21 | ||
22 | void *xmalloc(size_t); | 22 | void *xmalloc(size_t); |
23 | void *xcalloc(size_t, size_t); | ||
23 | void *xrealloc(void *, size_t); | 24 | void *xrealloc(void *, size_t); |
24 | void xfree(void *); | 25 | void xfree(void *); |
25 | char *xstrdup(const char *); | 26 | char *xstrdup(const char *); |
27 | int xasprintf(char **, const char *, ...) | ||
28 | __attribute__((__format__ (printf, 2, 3))) | ||
29 | __attribute__((__nonnull__ (2))); | ||
26 | 30 | ||
27 | #endif /* XMALLOC_H */ | 31 | #endif /* XMALLOC_H */ |