openssh/openssh-alloc_size.patch

29 lines
1.1 KiB
Diff
Raw Normal View History

--- openssh-7.1p2.orig/xmalloc.h
+++ openssh-7.1p2/xmalloc.h
@@ -16,10 +16,10 @@
* called by a name other than "ssh" or "Secure Shell".
*/
-void *xmalloc(size_t);
-void *xcalloc(size_t, size_t);
-void *xreallocarray(void *, size_t, size_t);
-char *xstrdup(const char *);
+void *xmalloc(size_t) __attribute__((__malloc__, __alloc_size__(1)));
+void *xcalloc(size_t, size_t) __attribute__((__malloc__, __alloc_size__(1,2)));
+void *xreallocarray(void *, size_t, size_t) __attribute__((__alloc_size__(2,3)));
+char *xstrdup(const char *) __attribute__((__malloc__));
int xasprintf(char **, const char *, ...)
__attribute__((__format__ (printf, 2, 3)))
__attribute__((__nonnull__ (2)));
--- openssh-7.1p2.orig/openbsd-compat/openbsd-compat.h
+++ openssh-7.1p2/openbsd-compat/openbsd-compat.h
@@ -66,7 +66,7 @@ char *getcwd(char *pt, size_t size);
#endif
#ifndef HAVE_REALLOCARRAY
-void *reallocarray(void *, size_t, size_t);
+void *reallocarray(void *, size_t, size_t) __attribute__((__alloc_size__(2,3)));
#endif
#if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH)