From: Apple Date: Thu, 6 Dec 2018 05:17:00 +0000 (+0000) Subject: system_cmds-805.220.1.tar.gz X-Git-Tag: macos-10141^0 X-Git-Url: https://git.saurik.com/apple/system_cmds.git/commitdiff_plain/30d34d88c06e1d03819436fb1c15203303bfaf12 system_cmds-805.220.1.tar.gz --- diff --git a/login.tproj/login.c b/login.tproj/login.c index d82ee2a..e04f404 100644 --- a/login.tproj/login.c +++ b/login.tproj/login.c @@ -1235,12 +1235,16 @@ getloginname(void) err(1, "malloc()"); do { (void)printf("%s", prompt); - for (p = nbuf; (ch = getchar()) != '\n'; ) { - if (ch == EOF) { - badlogin(username); - bail(NO_SLEEP_EXIT, 0); - } - if (p < nbuf + MAXLOGNAME - 1) + /* rdar://43101375 login process on 2018 hardware is blocked forever waiting on new line char + * The carriage return char is added to the termination condition of the + * for loop because for some reason, '\r' is returned by getchar() on M9 hardware. + */ + for (p = nbuf; (((ch = getchar()) != '\n') && (ch != '\r')); ) { + if (ch == EOF) { + badlogin(username); + bail(NO_SLEEP_EXIT, 0); + } + if (p < nbuf + MAXLOGNAME - 1) *p++ = ch; } } while (p == nbuf);