The use of strncpy and knowing the length of the string is the whole point of the change. strlen is dangerous if the string is not null-terminated and strcpy will happily overflow the target buffer if the source string is too long. The example code I gave is not intended to be a patch, but a starting point for correcting the problem.
The use of strncpy and knowing the length of the string is the whole point of the change. strlen is dangerous if the string is not null-terminated and strcpy will happily overflow the target buffer if the source string is too long. The example code I gave is not intended to be a patch, but a starting point for correcting the problem.