Re:Interviewing programmers: coding test example explained
by tptacek on Thursday June 03, 2010 @01:41PM
(#1401936)
fgets() bug/hack/exploit? You mean gets(), right?
Re:Interviewing programmers: coding test example explained
by RiderOfGiraffes on Thursday June 03, 2010 @01:45PM
(#1401948)
Er, probably. Brain fried, too much multi-tasking. Sorry.
This is the source of the notorious "fgets" bug/hack/exploit.
This is not the time or place for a tutorial on C strings and memory management, but suffice to say that some people find it horrible, some people find it easy and obvious. It stems from C being a sort of macro-assembler with a simplistic type system glued on top of it.
ADDED IN EDIT: I don't know why you got down-voted - it's a reasonable question from someone who hasn't done C. I've up-voted you to get you back to "1".