So i was reversing a 64 bit ELF binary, and it did a call to fgets, and based on documentation the third argument of fgets is a file pointer.
now the weird part was that the third argument in this binary pointed to a qword in libc which has the value of 9!
and this causes the stdin to come in to get the user input! now what is the meaning of this number 9? for a second i thought its a file descriptor number, but stdin is 0!
this binary is from a ctf challenge so you can download it too, its the last fgets in the challenge GETTING_CONFUSED :
i wrote a program with last parameter of fgets set as stdin, compiled it with gcc, and the pointer was pointing to a complete different thing, IDA recognized it as some instruction but I'm not sure, either way it was not 9, why?
ALSO, when i cat some input into the binary, the value becomes 19 after the call!, what does 19 mean?