DivestOS/Patches/Common/android_system_bt/0001-alloc_size.patch
Tad ad579b6681 Misc hardening from GrapheneOS
11 62f81c237b

11 1f05db99ab

11 f242089d3f
10 abcf485dcf
9x c5db5a9f9e

Signed-off-by: Tad <tad@spotco.us>
2022-03-15 14:40:05 -04:00

26 lines
952 B
Diff

From abcf485dcff6c7b06b0f241b4729fc8e2cf1d74f Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sat, 1 Jul 2017 13:21:18 -0400
Subject: [PATCH] add alloc_size attributes to the allocator
This results in expanded _FORTIFY_SOURCE coverage.
---
osi/include/allocator.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/osi/include/allocator.h b/osi/include/allocator.h
index 3a4141f384..4fa059eb14 100644
--- a/osi/include/allocator.h
+++ b/osi/include/allocator.h
@@ -37,8 +37,8 @@ extern const allocator_t allocator_calloc;
char* osi_strdup(const char* str);
char* osi_strndup(const char* str, size_t len);
-void* osi_malloc(size_t size);
-void* osi_calloc(size_t size);
+void* osi_malloc(size_t size) __attribute__((alloc_size(1)));
+void* osi_calloc(size_t size) __attribute__((alloc_size(1)));
void osi_free(void* ptr);
// Free a buffer that was previously allocated with function |osi_malloc|