Tags: binary-exploitation pwn 

Rating:

I was given the [binary](https://github.com/mar232320/ctf-writeups/raw/main/nactf/2022/gets) and it's [source code](https://github.com/mar232320/ctf-writeups/raw/main/nactf/2022/gets.c)

In there there is the vulnerable gets() function and a variable magic I had to overflow. ascii reprezentation of 42 is * .

The buffer of char input is 16, char takes 8 bytes itself and int 4 bytes so the overflow value must be 28. My payload was a*28 + *
Sending it gave me the flag

# nactf{buff3r_0v3rfl0w_b3g1nn1ngs}

Original writeup (https://github.com/mar232320/ctf-writeups/blob/main/nactf/2022/onceuponagets.md).