Skip to content

Instantly share code, notes, and snippets.

@joshenders
Created October 27, 2013 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshenders/7189009 to your computer and use it in GitHub Desktop.
Save joshenders/7189009 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#define PADDING 255
void fill(unsigned char* addr, size_t buffer) {
unsigned long i;
for (i = 0; i < buffer; i++) {
*(addr + i) = PADDING;
}
}
int main(int argc, char **argv) {
unsigned char *segment;
size_t buffer = 1 << 30;
segment = malloc(4*buffer);
printf("Filled %zu bytes starting at %zx with %x\n", buffer, segment, PADDING);
fill(segment, buffer);
getchar();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment