Skip to content

Instantly share code, notes, and snippets.

@Elkamika
Created September 4, 2023 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Elkamika/e02d9db8a0f8260ed37b3efc4399b800 to your computer and use it in GitHub Desktop.
Save Elkamika/e02d9db8a0f8260ed37b3efc4399b800 to your computer and use it in GitHub Desktop.
Int overflow demo
#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