logoalt Hacker News

ufolast Tuesday at 2:57 PM1 replyview on HN

A big footgun with strncpy is that the output string may not be null terminated.


Replies

kccqzylast Tuesday at 3:03 PM

Yeah but fixed width strings don’t need null termination. You know exactly how long the string is. No need to find that null byte.

show 2 replies