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:
@@ -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),
|
if ((hp = gethostbyaddr((char *)&raddr, sizeof(u_long),
|
||||||
AF_INET)) == NULL)
|
AF_INET)) == NULL)
|
||||||
return (-1);
|
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)) {
|
while (fgets(buf, sizeof(buf), hostf)) {
|
||||||
p = buf;
|
p = buf;
|
||||||
|
Reference in New Issue
Block a user