summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/xmalloc.h
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2006-03-25 00:05:42 +0000
committerDamien Miller <djm@cvs.openbsd.org>2006-03-25 00:05:42 +0000
commit2deaa1649526d4ce68eed29e66d89d32fea75950 (patch)
treed92b455fbeda76727a52c07da67f7c2fbf210a5e /usr.bin/ssh/xmalloc.h
parent8748ab126c563a181843be1e20e74225a6c34369 (diff)
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 'usr.bin/ssh/xmalloc.h')
-rw-r--r--usr.bin/ssh/xmalloc.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/ssh/xmalloc.h b/usr.bin/ssh/xmalloc.h
index 7ac4b13d64c..b6d521a66db 100644
--- a/usr.bin/ssh/xmalloc.h
+++ b/usr.bin/ssh/xmalloc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: xmalloc.h,v 1.9 2002/06/19 00:27:55 deraadt Exp $ */
+/* $OpenBSD: xmalloc.h,v 1.10 2006/03/25 00:05:41 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -20,8 +20,12 @@
#define XMALLOC_H
void *xmalloc(size_t);
+void *xcalloc(size_t, size_t);
void *xrealloc(void *, size_t);
void xfree(void *);
char *xstrdup(const char *);
+int xasprintf(char **, const char *, ...)
+ __attribute__((__format__ (printf, 2, 3)))
+ __attribute__((__nonnull__ (2)));
#endif /* XMALLOC_H */