General discussion

Locked

Buffer Overflows in C/C++

By gmesser57 ·
In the article on buffer overflows, the author says use strncpy() instead of strcpy. I've found that to be only slightly less dangerous than straight strcpy(). The reason is that if you copy the max number of characters to the destination, then it stops, which is good, but it does not append the null character, which is bad when you try to use the destination later.

Is it still like that in C99? If so, care still needs to be taken with strncpy().

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to Web Development Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums