Hi, * Peter Eriksen [06-06-11 14:03:28 +0200] wrote:
-char *safe_strncpy(char *dest, const char *src, size_t n) +size_t safe_strncpy(char *dest, const char *src, size_t size) { - strncpy(dest, src, n); - dest[n - 1] = '\0'; + size_t ret = strlen(src);
At least FreeBSD's strlen() requires a non-NULL argument, i.e. with src==NULL, this will segfault.
If you can ensure that src!=NULL, then it's okay, but the safe_ prefix implies something different.
bye, Rocco -- :wq! - : send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html