about summary refs log tree commit diff
path: root/utils/libdislocator/libdislocator.so.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2022-10-11 15:40:55 +0200
committerGitHub <noreply@github.com>2022-10-11 15:40:55 +0200
commitcbfa5207ba2853e249ffb256d99880368ee224e0 (patch)
tree0ca719900045ab9171b9fb2590b2323e31e9bd5f /utils/libdislocator/libdislocator.so.c
parent7e0171006a32bf6b510e08df76ca6d8555272140 (diff)
parentbac6ba89074019e0f095774ecebc435970f4940d (diff)
downloadafl++-4.04c.tar.gz
Merge pull request #1551 from AFLplusplus/dev 4.04c
push to stable
Diffstat (limited to 'utils/libdislocator/libdislocator.so.c')
-rw-r--r--utils/libdislocator/libdislocator.so.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/utils/libdislocator/libdislocator.so.c b/utils/libdislocator/libdislocator.so.c
index a6d8ecfd..c390d004 100644
--- a/utils/libdislocator/libdislocator.so.c
+++ b/utils/libdislocator/libdislocator.so.c
@@ -510,6 +510,24 @@ __attribute__((alloc_size(2, 3))) void *reallocarray(void *ptr, size_t elem_len,
 
 }
 
+int reallocarr(void *ptr, size_t elem_len, size_t elem_cnt) {
+
+  void        *ret = NULL;
+  const size_t elem_tot = elem_len * elem_cnt;
+
+  if (elem_tot == 0) {
+
+    void **h = &ptr;
+    *h = ret;
+    return 0;
+
+  }
+
+  ret = reallocarray(ptr, elem_len, elem_cnt);
+  return ret ? 0 : -1;
+
+}
+
 #if defined(__APPLE__)
 size_t malloc_size(const void *ptr) {