From 52d79f02f62f9767d3557255667144296e87c027 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Thu, 29 May 1997 19:44:14 +0000 Subject: [PATCH] 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 --- src/clients/kinit/ChangeLog | 5 +++++ src/clients/kinit/kinit.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) 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); -- 2.26.2