From: jem@niksula.hut.fi (Johan Myreen) Subject: Bug in login Date: 21 Feb 1992 20:02:29 GMT
I found a minor bug in the login program distributed with the
poeigl-package. If you enter more than seven characters at the
password prompt, the superfluous characters are passed to the shell.
I also added a putchar('\n') after reading the password, since
pressing return after the password doesn't echo as a newline.
Johan Myreen
jem@cs.hut.fi
*** login.c.orig Fri Feb 21 11:12:38 1992
--- login.c Fri Feb 21 11:03:35 1992
***************
*** 860,869 ****
--- 860,874 ----
while(--cnt >= 0 && read(0, &ch, 1) == 1 && ch != '\n')
*buf++ = ch;
+ while(ch != '\n'&& read(0, &ch, 1) == 1)
+ ;
+
*buf = '\0';
ti.c_lflag |= ECHO;
(void)ioctl(0, TCSETA, &ti);
+
+ putchar('\n');
return passwd;
}