about summary refs log tree commit diff
path: root/inet
diff options
context:
space:
mode:
Diffstat (limited to 'inet')
-rw-r--r--inet/rcmd.c12
-rw-r--r--inet/rexec.c3
2 files changed, 10 insertions, 5 deletions
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 923f21fe40..30f20d1922 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -80,7 +80,8 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
 	hstbuflen = 1024;
 	tmphstbuf = __alloca (hstbuflen);
 	while (__gethostbyname_r (*ahost, &hostbuf, tmphstbuf, hstbuflen,
-				  &hp, &herr) != 0)
+				  &hp, &herr) != 0
+	       || hp == NULL)
 	  if (herr != NETDB_INTERNAL || errno != ERANGE)
 	    {
 	      __set_h_errno (herr);
@@ -270,7 +271,8 @@ ruserok(rhost, superuser, ruser, luser)
 	buffer = __alloca (buflen);
 
 	while (__gethostbyname_r (rhost, &hostbuf, buffer, buflen, &hp, &herr)
-	       != 0)
+	       != 0
+	       || hp == NULL)
 	  if (herr != NETDB_INTERNAL || errno != ERANGE)
 	    return -1;
 	  else
@@ -370,7 +372,8 @@ iruserok2 (raddr, superuser, ruser, luser, rhost)
       char *buffer = __alloca (buflen);
       uid_t uid;
 
-      if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd))
+      if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) != 0
+	  || pwd == NULL)
 	return -1;
 
       dirlen = strlen (pwd->pw_dir);
@@ -469,7 +472,8 @@ __icheckhost (raddr, lhost, rhost)
 	buffer = __alloca (buflen);
 	save_errno = errno;
 	while (__gethostbyname_r (lhost, &hostbuf, buffer, buflen, &hp, &herr)
-	       != 0)
+	       != 0
+	       || hp = NULL)
 		if (herr != NETDB_INTERNAL || errno != ERANGE)
 			return (0);
 		else {
diff --git a/inet/rexec.c b/inet/rexec.c
index 6ba7d20f71..897030e6b9 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -64,7 +64,8 @@ rexec(ahost, rport, name, pass, cmd, fd2p)
 	hstbuflen = 1024;
 	hsttmpbuf = __alloca (hstbuflen);
 	while (__gethostbyname_r (*ahost, &hostbuf, hsttmpbuf, hstbuflen,
-				  &hp, &herr) != 0)
+				  &hp, &herr) != 0
+	       || hp == NULL)
 	  if (herr != NETDB_INTERNAL || errno != ERANGE)
 	    {
 	      __set_h_errno (herr);