Im getting acquainted with Buffer Overflows (BOF) and was replicating a simple attack described by Techorganic. They create a simple C program called "classic", which contains an obvious BOF vulnerability (when it reads up to 400bytes into an 80byte buffer from STDIN), and then create the proper buffer to exploit it, and save said buffer it to "in.txt". Despite it running its course smoothly, once all preparations are done with, they execute the program with the following command:
user@pc$ (cat in.txt ; cat) | ./classic
My first thought was "holy moly, what's going on there?", the original idea was simple, run classic and input the buffer, my intention was to execute it as:
user@pc$ ./classic < in.txt
Just like any other mortal would do. But to my surprise, their way works, and mine doesn't.
Bottom line is: What does the first syntax do and what is the key difference that made their solution work and mine not, despite them being semantically equal (or similar, apparently).