Use strlcpy instead of strncpy, pointed out by deraadt.

This commit is contained in:
Nicholas Marriott 2009-10-26 21:10:24 +00:00
parent 353f2a2ad4
commit 6dc6333323

View File

@ -29,13 +29,14 @@
char * char *
xstrdup(const char *s) xstrdup(const char *s)
{ {
void *ptr; char *ptr;
size_t len; size_t len;
len = strlen(s) + 1; len = strlen(s) + 1;
ptr = xmalloc(len); ptr = xmalloc(len);
return (strncpy(ptr, s, len)); strlcpy(ptr, s, len);
return (ptr);
} }
void * void *