Created
October 27, 2013 23:08
-
-
Save joshenders/7189009 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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