careful not to thrust h_length from gethostby{name,addr}
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1056 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -68,7 +68,7 @@ inaddr2str(struct in_addr addr, char *s, size_t len)
|
||||
h = gethostbyname (h->h_name);
|
||||
if(h)
|
||||
while ((p = *(h->h_addr_list)++))
|
||||
if (memcmp (p, &addr, h->h_length) == 0) {
|
||||
if (memcmp (p, &addr, sizeof(addr)) == 0) {
|
||||
strncpy (s, h->h_name, len);
|
||||
s[len - 1] = '\0';
|
||||
return;
|
||||
|
@@ -100,8 +100,9 @@ __ivaliduser(FILE *hostf, u_int32_t raddr, const char *luser, const char *ruser)
|
||||
#define ypdomain NULL
|
||||
#endif
|
||||
/* We need to get the damn hostname back for netgroup matching. */
|
||||
if ((hp = gethostbyaddr((char *)&raddr, sizeof(u_long),
|
||||
AF_INET)) == NULL)
|
||||
if ((hp = gethostbyaddr((char *)&raddr,
|
||||
sizeof(u_long),
|
||||
AF_INET)) == NULL)
|
||||
return (-1);
|
||||
strncpy(hname, hp->h_name, sizeof(hname));
|
||||
hname[sizeof(hname) - 1] = '\0';
|
||||
|
Reference in New Issue
Block a user