ButterOverflow
Checking the code we can see that if the a buffer overflow exception occur the program will print the flag. Since the buffer allocated is 512 bytes long and is using the gets
function to get the data for it we can easily insert for example 600 bytes and get the flag:
flag{72d8784a5da3a8f56d2106c12dbab989}