From: Theodore Tso Date: Thu, 29 May 1997 19:44:14 +0000 (+0000) Subject: Fix bug where kinit would core dump if given a really long principal X-Git-Tag: krb5-1.1-beta1~1134 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=52d79f02f62f9767d3557255667144296e87c027;p=krb5.git Fix bug where kinit would core dump if given a really long principal name. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10090 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/clients/kinit/ChangeLog b/src/clients/kinit/ChangeLog index 3aa66c281..500bbc7a8 100644 --- a/src/clients/kinit/ChangeLog +++ b/src/clients/kinit/ChangeLog @@ -1,3 +1,8 @@ +Thu May 29 19:39:08 1997 Theodore Y. Ts'o + + * kinit.c (main): Fix bug where kinit would core dump if given a + really long principal name. + Tue Feb 25 00:29:46 1997 Richard Basch * kinit.c: Moved krb5_read_password back into the library (win32) diff --git a/src/clients/kinit/kinit.c b/src/clients/kinit/kinit.c index bae27955d..bc0a1eafe 100644 --- a/src/clients/kinit/kinit.c +++ b/src/clients/kinit/kinit.c @@ -89,7 +89,7 @@ main(argc, argv) krb5_keytab keytab = NULL; struct passwd *pw = 0; int pwsize; - char password[255], *client_name, prompt[255]; + char password[255], *client_name, prompt[1024]; code = krb5_init_context(&kcontext); if (code) { @@ -280,7 +280,7 @@ main(argc, argv) exit(1); } } else { - if (code = krb5_parse_name(kcontext, service_name, &server)) { + if ((code = krb5_parse_name(kcontext, service_name, &server))) { com_err(argv[0], code, "while parsing service name %s", service_name); exit(1); @@ -331,7 +331,8 @@ main(argc, argv) if (!use_keytab) #endif { - (void) sprintf(prompt,"Password for %s: ", (char *) client_name); + (void) sprintf(prompt, "Password for %.*s: ", + sizeof(prompt)-32, (char *) client_name); pwsize = sizeof(password);