[8479] in Athena Bugs
attach
daemon@ATHENA.MIT.EDU (John Carr)
Sat Oct 26 17:13:50 1991
To: bugs@Athena.MIT.EDU
Date: Sat, 26 Oct 91 17:13:41 EDT
From: John Carr <jfc@Athena.MIT.EDU>
This patch fixes 2 bugs:
1. This line in attach.conf caused a NULL pointer dereference:
ownercheck
2. The hostaddr field of the attachtab was used without being set.
This caused very long lines in attachtab.
*** /source/athena/athena.bin/attach/config.c Fri Jul 20 14:50:11 1990
--- config.c Sat Oct 26 16:59:02 1991
***************
*** 141,155 ****
caddr_t variable;
int arg;
{
! if (!strcmp(argument, "on"))
* (int *) variable = 1;
! else if (!strcmp(argument, "off"))
* (int *) variable = 0;
else {
if (arg == -1)
fprintf(stderr,
"%s: Argument to %s must be on or off!\n",
argument, keyword);
else
* (int *) variable = arg; /* Default */
}
--- 141,158 ----
caddr_t variable;
int arg;
{
! if (argument && !strcmp(argument, "on"))
* (int *) variable = 1;
! else if (argument && !strcmp(argument, "off"))
* (int *) variable = 0;
else {
if (arg == -1)
+ if (argument)
fprintf(stderr,
"%s: Argument to %s must be on or off!\n",
argument, keyword);
+ else
+ fprintf(stderr, "%s: Argument required!\n", keyword);
else
* (int *) variable = arg; /* Default */
}
*** /source/athena/athena.bin/attach/attachtab.c Mon Jul 1 09:47:30 1991
--- attachtab.c Sat Oct 26 16:46:55 1991
***************
*** 280,286 ****
if (!(cp = strtok(NULL, TOKSEP)))
goto bad_line;
! for (i=0; cp; i++) {
register char *dp;
if (dp = index(cp, ','))
--- 280,286 ----
if (!(cp = strtok(NULL, TOKSEP)))
goto bad_line;
! for (i=0; cp && i < MAXHOSTS; i++) {
register char *dp;
if (dp = index(cp, ','))
***************
*** 288,293 ****
--- 288,295 ----
at->hostaddr[i].s_addr = inet_addr(cp);
cp = dp;
}
+ while (i < MAXHOSTS)
+ at->hostaddr[i++].s_addr = 0;
if (!(cp = strtok(NULL, TOKSEP)))
goto bad_line;