← Commit list

22f6dcb47

Denis Vlasenko
Denis Vlasenko
2006-09-26
SOURCE BUG Duration: 57s

Subject

login: fix getopt_ulflags fallout (wasn't taking username supplied by getty)

SOURCE BUG

This commit was genuinely broken at the time (not related to our build system): scripts/config/mkconfigs.c (2005-08-01 - 2006-10-05 arasi) uretilen bbconfigopts.h icine .config satirlarini kacissiz, ham newline'larla gömüyordu - gecerli C degildi, busybox'un kendi bb_mkdep araci bile parse edemiyordu (7d219aab7 ile duzeltildi, mkconfigs shell scripte cevrildi)

→ Bu hatanin tam hikayesini ve duzeltme diffini gor

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

loginutils/login.c+3 -3
@@ -235,13 +235,13 @@ int login_main(int argc, char **argv)
alarm(TIMEOUT);
opt = bb_getopt_ulflags(argc, argv, "f:h:p", &opt_user, &opt_host);
-
if (opt & LOGIN_OPT_f) {
if (!amroot)
bb_error_msg_and_die("-f is for root only");
- safe_strncpy(username, opt_user, strlen(opt_user));
+ safe_strncpy(username, opt_user, sizeof(username));
}
- username[USERNAME_SIZE] = 0;
+ if (optind < argc) /* user from command line (getty) */
+ safe_strncpy(username, argv[optind], sizeof(username));
/* Let's find out and memorize our tty */
if (!isatty(0) || !isatty(1) || !isatty(2))