guy%gorodish@Sun.COM (Guy Harris) (01/15/87)
Index: lib/libc/net/rcmd.c 4.3BSD Description: "rcmd" assumes that ((char *)NULL + 1) == (char *)1. This may happen to be true on both machines, but it is not guaranteed to be true. Repeat-By: Read the code, preferably with air-sickness bag handy. Fix: *** /arch/4.3/usr/src/lib/libc/net/rcmd.c Tue May 6 14:35:22 1986 --- rcmd.c Wed Jan 14 13:19:38 1987 *************** *** 270,275 **** --- 270,276 ---- { static char ldomain[MAXHOSTNAMELEN + 1]; static char *domainp = NULL; + static int nodomain = 0; register char *cp; if (len == -1) *************** *** 280,285 **** --- 281,288 ---- return(1); if (*(lhost + len) != '\0') return(0); + if (nodomain) + return(0); if (!domainp) { if (gethostname(ldomain, sizeof(ldomain)) == -1) { domainp = (char *)1; *************** *** 286,293 **** return(0); } ldomain[MAXHOSTNAMELEN] = NULL; ! if ((domainp = index(ldomain, '.') + 1) == (char *)1) return(0); cp = domainp; while (*cp) { *cp = isupper(*cp) ? tolower(*cp) : *cp; --- 289,299 ---- return(0); } ldomain[MAXHOSTNAMELEN] = NULL; ! if ((domainp = index(ldomain, '.')) == (char *)NULL) { ! nodomain = 1; return(0); + } + domainp++; cp = domainp; while (*cp) { *cp = isupper(*cp) ? tolower(*cp) : *cp; *************** *** 294,300 **** cp++; } } - if (domainp == (char *)1) - return(0); return(!strcmp(domainp, rhost + len +1)); } --- 300,304 ----