Y
Hacker News
new
|
ask
|
show
|
jobs
by
ori_b
3441 days ago
And it's still wrong, since strncpy() doesn't null terminate: it null pads. That means that if the string is longer than the buffer, it will not be correctly terminated.
1 comments
iMerNibor
3440 days ago
They do check the string size before using strncpy though, so it should be fine
link
ori_b
3440 days ago
The check is off by one. If it's equal in length to the buffer, then the buffer will not be nul terminated.
link