diff --git a/lib/roken/iruserok.c b/lib/roken/iruserok.c index a85d781dd..abd829bd2 100644 --- a/lib/roken/iruserok.c +++ b/lib/roken/iruserok.c @@ -94,7 +94,8 @@ __ivaliduser(FILE *hostf, u_int32_t raddr, const char *luser, const char *ruser) if ((hp = gethostbyaddr((char *)&raddr, sizeof(u_long), AF_INET)) == NULL) return (-1); - strcpy(hname, hp->h_name); + strncpy(hname, hp->h_name, sizeof(hname)); + hname[sizeof(hname) - 1] = '\0'; while (fgets(buf, sizeof(buf), hostf)) { p = buf;