Defensive programming: Difference between revisions

Content deleted Content added
Secure programming: sizeof does not work on arrays, it just returns the size in bytes of the array element 0
Tag: Reverted
Line 35:
 
// Copy input without exceeding the length of the destination.
strncpy(str, input, sizeofstrlen(str));
 
// If strlen(input) >= sizeof(str) then strncpy won't null terminate.