News for hackers. Stuff that matters.
Re:What I learned from my first C coding challenge by tptacek on Tuesday September 04, 2012 @03:29PM (#4476120)
I'm sorry, I should have been more direct. No, I meant to say. Using "strcmp" in a typical C program is not a security flaw. It was clear to me you were thinking of "strcat" or "strcpy".

Using strncmp in this situation makes very little sense and is probably more dangerous. The lengths given to strncmp() are inevitably going to be derived from something else that requires a NUL terminator. Meanwhile, strncmp() leaves you open to logic flaws where you compare too few bytes.

There are no comments on this comment yet.