openssh/openssh-alloc_size.patch
Petr Cerny b83f96744f Accepting request 358392 from home:elvigia:branches:network
- openssh-alloc_size.patch: anotate xmalloc.h with alloc_size
 attribute so the compiler knows these functions allocate memory
 so overflow or misuse can be detected sooner.
- openssh-allow_getrandom.patch; allow the getrandom(2) system
  call in the seccomp sandbox, upstream commit 26ad18247213
- openssh-fix-b64_xx-detection.patch: configure.ac has incorrect
  tests for b64_ntop, b64_pton on linux/glibc.

OBS-URL: https://build.opensuse.org/request/show/358392
OBS-URL: https://build.opensuse.org/package/show/network/openssh?expand=0&rev=96
2016-02-10 15:40:35 +00:00

29 lines
1.1 KiB
Diff

--- 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)