Skip to content

Instantly share code, notes, and snippets.

@adrianparvino
Created April 29, 2018 01:51
Show Gist options
  • Save adrianparvino/6ae8beb630dde1bb57845d4b7dc62ba1 to your computer and use it in GitHub Desktop.
Save adrianparvino/6ae8beb630dde1bb57845d4b7dc62ba1 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <errno.h>
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main(void)
{
char *a;
//a = malloc(SIZE_MAX / 2);
a = malloc(SIZE_MAX);
//char *b = strerror(errno);
//write(2, b, strlen(b));
perror("malloc error\n");
memset(a, SIZE_MAX, 'a');
for(size_t i = 0; i < SIZE_MAX; i += 4096)
printf("%c", a[i]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment