News for hackers. Stuff that matters.
Re:Beware of strncpy and strncat by nebulous1 on Wednesday June 06, 2018 @12:37PM (#17248592)
He's assuming that dest is zero-initialized, which I believe it will be as written. However, he should mention that because there will be plenty of similar cases where dest will not be initialized.

edit: As asveikau notes below, this is not the case

Re:Beware of strncpy and strncat by docker_up on Wednesday June 06, 2018 @12:46PM (#17248701)
No, only global variables are zero-initialized. Neither stack variables nor malloced memory will be zero-initialized. OP should have memset to 0 or calloced the memory.
Re:Beware of strncpy and strncat by asveikau on Wednesday June 06, 2018 @12:38PM (#17248613)
> He's assuming that dest is zero-initialized, which I believe it will be as written.

Given this snippet, incorrect. Stack allocated buffers aren't zeroed out as in the above declaration.

Re:Beware of strncpy and strncat by nebulous1 on Wednesday June 06, 2018 @12:42PM (#17248658)
Well, then that's pretty bad!