diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index d69301c4be89..6d7fddd7c60a 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -3261,9 +3261,15 @@ char * allocopy(p) char *p; { - char *q = (char *)malloc(strlen(p) + 1); + int len = strlen(p) + 1; + char *q = (char *)malloc(len); - strcpy(q, p); + if (!q) { + fatal("malloc"); + /*NOTREACHED*/ + } + + strlcpy(q, p, len); return q; }