RPISEC / MBE

Course materials for Modern Binary Exploitation by RPISEC
BSD 2-Clause "Simplified" License
5.43k stars 881 forks source link

lab6b (ASLR) | Newlines are not being removed from user input fields #40

Open SharonBrizinov opened 4 years ago

SharonBrizinov commented 4 years ago

https://github.com/RPISEC/MBE/blob/2b0b6773eb36e6375186126b0fe489ce6503d2b6/src/lab06/lab6B.c#L120

Newlines are not being removed from any user input (both for username and password). Therefore, unless they are both 32 bytes long, they will never match the actual fields because of the '\n' difference.

I suggest adding this after both fgets calls: readbuff[strcspn(readbuff, "\n")] = 0;