aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-03-10 22:04:05 +0100
committerDominik Maier <domenukk@gmail.com>2020-03-10 22:04:05 +0100
commitcc1d6b33b1524d52b21a6e9794ee6b0d6a2a9d50 (patch)
tree717c62b52076b37cb9d4e4efc9f33cf09dea723b /examples
parent2832cb643d90ff6bad7a6ba4ff139988f10b171a (diff)
downloadafl++-cc1d6b33b1524d52b21a6e9794ee6b0d6a2a9d50.tar.gz
unified pointer placement
Diffstat (limited to 'examples')
-rw-r--r--examples/argv_fuzzing/argv-fuzz-inl.h6
-rw-r--r--examples/persistent_demo/persistent_demo.c2
-rw-r--r--examples/post_library/post_library.so.c8
-rw-r--r--examples/post_library/post_library_png.so.c14
-rw-r--r--examples/qemu_persistent_hook/read_into_rdi.c4
5 files changed, 17 insertions, 17 deletions
diff --git a/examples/argv_fuzzing/argv-fuzz-inl.h b/examples/argv_fuzzing/argv-fuzz-inl.h
index c595f7ea..c15c0271 100644
--- a/examples/argv_fuzzing/argv-fuzz-inl.h
+++ b/examples/argv_fuzzing/argv-fuzz-inl.h
@@ -55,12 +55,12 @@
#define MAX_CMDLINE_LEN 100000
#define MAX_CMDLINE_PAR 50000
-static char** afl_init_argv(int* argc) {
+static char **afl_init_argv(int *argc) {
static char in_buf[MAX_CMDLINE_LEN];
- static char* ret[MAX_CMDLINE_PAR];
+ static char *ret[MAX_CMDLINE_PAR];
- char* ptr = in_buf;
+ char *ptr = in_buf;
int rc = 0;
if (read(0, in_buf, MAX_CMDLINE_LEN - 2) < 0) {}
diff --git a/examples/persistent_demo/persistent_demo.c b/examples/persistent_demo/persistent_demo.c
index 7d8638fb..36f12850 100644
--- a/examples/persistent_demo/persistent_demo.c
+++ b/examples/persistent_demo/persistent_demo.c
@@ -30,7 +30,7 @@
/* Main entry point. */
-int main(int argc, char** argv) {
+int main(int argc, char **argv) {
ssize_t len; /* how much input did we read? */
char buf[100]; /* Example-only buffer, you'd replace it with other global or
diff --git a/examples/post_library/post_library.so.c b/examples/post_library/post_library.so.c
index 487b9a6d..a38652ce 100644
--- a/examples/post_library/post_library.so.c
+++ b/examples/post_library/post_library.so.c
@@ -76,11 +76,11 @@
/* The actual postprocessor routine called by afl-fuzz: */
-const unsigned char* afl_postprocess(const unsigned char* in_buf,
- unsigned int* len) {
+const unsigned char *afl_postprocess(const unsigned char *in_buf,
+ unsigned int *len) {
- static unsigned char* saved_buf;
- unsigned char* new_buf;
+ static unsigned char *saved_buf;
+ unsigned char *new_buf;
/* Skip execution altogether for buffers shorter than 6 bytes (just to
show how it's done). We can trust *len to be sane. */
diff --git a/examples/post_library/post_library_png.so.c b/examples/post_library/post_library_png.so.c
index 43cb1101..60ab318f 100644
--- a/examples/post_library/post_library_png.so.c
+++ b/examples/post_library/post_library_png.so.c
@@ -35,13 +35,13 @@
#define UP4K(_i) ((((_i) >> 12) + 1) << 12)
-const unsigned char* afl_postprocess(const unsigned char* in_buf,
- unsigned int* len) {
+const unsigned char *afl_postprocess(const unsigned char *in_buf,
+ unsigned int * len) {
- static unsigned char* saved_buf;
+ static unsigned char *saved_buf;
static unsigned int saved_len;
- unsigned char* new_buf = (unsigned char*)in_buf;
+ unsigned char *new_buf = (unsigned char *)in_buf;
unsigned int pos = 8;
/* Don't do anything if there's not enough room for the PNG header
@@ -58,7 +58,7 @@ const unsigned char* afl_postprocess(const unsigned char* in_buf,
/* Chunk length is the first big-endian dword in the chunk. */
- chunk_len = ntohl(*(uint32_t*)(in_buf + pos));
+ chunk_len = ntohl(*(uint32_t *)(in_buf + pos));
/* Bail out if chunk size is too big or goes past EOF. */
@@ -71,7 +71,7 @@ const unsigned char* afl_postprocess(const unsigned char* in_buf,
/* The in-file checksum is the last dword past the chunk data. */
- file_cksum = *(uint32_t*)(in_buf + pos + 8 + chunk_len);
+ file_cksum = *(uint32_t *)(in_buf + pos + 8 + chunk_len);
/* If the checksums do not match, we need to fix the file. */
@@ -98,7 +98,7 @@ const unsigned char* afl_postprocess(const unsigned char* in_buf,
}
- *(uint32_t*)(new_buf + pos + 8 + chunk_len) = real_cksum;
+ *(uint32_t *)(new_buf + pos + 8 + chunk_len) = real_cksum;
}
diff --git a/examples/qemu_persistent_hook/read_into_rdi.c b/examples/qemu_persistent_hook/read_into_rdi.c
index 3994e790..43f1758f 100644
--- a/examples/qemu_persistent_hook/read_into_rdi.c
+++ b/examples/qemu_persistent_hook/read_into_rdi.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <unistd.h>
-#define g2h(x) ((void*)((unsigned long)(x) + guest_base))
+#define g2h(x) ((void *)((unsigned long)(x) + guest_base))
#define h2g(x) ((uint64_t)(x)-guest_base)
enum {
@@ -35,7 +35,7 @@ enum {
};
-void afl_persistent_hook(uint64_t* regs, uint64_t guest_base) {
+void afl_persistent_hook(uint64_t *regs, uint64_t guest_base) {
// In this example the register RDI is pointing to the memory location
// of the target buffer, and the length of the input is in RAX.