Removed potential buffer overrun after `gethostbyaddr'.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@659 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1996-08-18 23:26:39 +00:00
parent 55b5b0c192
commit c6a9c5947b

View File

@@ -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;