about summary refs log tree commit diff
path: root/libdislocator/libdislocator.so.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2019-10-28 22:36:29 +0100
committervan Hauser <vh@thc.org>2019-10-28 22:36:29 +0100
commit6238df88a26d8498b4a821897f030a866dafdc24 (patch)
tree22e1161da0881ed5580653e313ee23ae3845e929 /libdislocator/libdislocator.so.c
parent38d74f0ad56a74cfed1eec04a8a46b4f8e4ec824 (diff)
downloadafl++-6238df88a26d8498b4a821897f030a866dafdc24.tar.gz
fixed warning and return
Diffstat (limited to 'libdislocator/libdislocator.so.c')
-rw-r--r--libdislocator/libdislocator.so.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c
index 5246af40..b3a90366 100644
--- a/libdislocator/libdislocator.so.c
+++ b/libdislocator/libdislocator.so.c
@@ -269,13 +269,11 @@ void* realloc(void* ptr, size_t len) {
    a normal request */
 
 int posix_memalign(void** ptr, size_t align, size_t len) {
-   if (!ptr) FATAL("null pointer on posix_memalign()");
-   if ((align % 2) || (align % sizeof(void *))) FATAL("bad alignment on posix_memalign()");
-   if (align >= 4 * sizeof(size_t)) {
-
-     len += align -1;
-
-   }
+   if ((char*)ptr == NULL || *ptr == NULL) 
+     return -1; // why would we do: FATAL("null pointer on posix_memalign()");
+   if ((align % 2) || (align % sizeof(void *)))
+     return -1; // why would we do: FATAL("bad alignment on posix_memalign()");
+   if (align >= 4 * sizeof(size_t)) len += align -1;
 
    *ptr = malloc(len);