-
-
Save Elkamika/e02d9db8a0f8260ed37b3efc4399b800 to your computer and use it in GitHub Desktop.
Int overflow demo
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> | |
int main(int argc, char const *argv[]) | |
{ | |
unsigned int buff_length = 1000; | |
unsigned int user_input = 0xffffffff; | |
if (user_input + 10 > buff_length) { | |
puts("user input too BIG"); | |
return 1; | |
} | |
puts("User input accepted"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment