Skip to content

Instantly share code, notes, and snippets.

@adrianparvino
Created April 29, 2018 01:46
Show Gist options
  • Save adrianparvino/cd418cae5f7a764d5004fb7b1cb31387 to your computer and use it in GitHub Desktop.
Save adrianparvino/cd418cae5f7a764d5004fb7b1cb31387 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);
errno = 0;
a = malloc(SIZE_MAX);
a[SIZE_MAX-1] = 'a';
printf("%c\n", *a);
//char *b = strerror(errno);
//write(2, b, strlen(b));
perror("malloc error\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment