brintos

brintos / llvm-project-archived public Read only

0
0
Text · 437 B · 44cdd47 Raw
15 lines · c
1#include <stdlib.h>2#include <string.h>3 4int main(int argc, char **argv) {5  char *memory = malloc(1024);6  memset(memory, '-', 1024);7  // Write "interesting" characters at an offset from the memory filled with8  // `-`. This way, if we read outside the range in either direction, we should9  // find `-`s`.10  int offset = 42;11  for (int i = offset; i < offset + 14; i++)12    memory[i] = 'a' + (i - offset);13  return 0; // break here14}15