Created
January 15, 2018 22:43
-
-
Save jld/1d447be7ab180cfa74765fedb42ba164 to your computer and use it in GitHub Desktop.
This file contains 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> | |
#include <string.h> | |
#define LARGENUM 0x80000001 | |
int main() | |
{ | |
char* buf = malloc(LARGENUM + 1); | |
memset(buf, 'X', LARGENUM); | |
buf[LARGENUM] = '\0'; | |
printf("%s", buf); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This program is ill-formed. It is not allowed to print more characters than INT_MAX in a single printf function call. See the description of the meaning of the printf return value as defined in the C language standard.