I have a program running on terminal 1 and waiting for input from stdin. I programmed this program so it is vulnerable to buffer-overflow. I want to change it's flow to function2() within the program so I opened GDB in terminal 2, attached it to the program in terminal 1 using its PID and found out the address of function2().
Now I want to use printf in third terminal to create a certain output and redirect this output to the program in terminal 1. How do I do it?
PS: I'm new to this kind of exercise and do not know if there's a better way of doing this. Please let me know if there is.