Secure coding: Difference between revisions

Content deleted Content added
Buffer-overflow prevention: terminate last character with NUL
Line 24:
// copy a maximum of BUF_SIZE bytes
strncpy(dst, user_input, BUF_SIZE);
// set the last character in the buffer to NUL,.
dst[BUF_SIZE -1] = '\0';
}