diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 1998-07-13 19:57:20 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 1998-07-13 19:57:20 +0000 |
commit | fc09b4b394ea6acc884b777863ed1a62d2daabc1 (patch) | |
tree | 53dff5b197075aefa68bbec9968d389435790d5b | |
parent | 40230a1311e1c5aa0e24fa4a724e565188e7ab7d (diff) |
bigger buffer for gethostname
-rw-r--r-- | kerberosIV/kerberos/kerberos.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/kerberosIV/kerberos/kerberos.c b/kerberosIV/kerberos/kerberos.c index f5157d0e1d8..0138f9bad86 100644 --- a/kerberosIV/kerberos/kerberos.c +++ b/kerberosIV/kerberos/kerberos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kerberos.c,v 1.12 1998/02/25 15:50:57 art Exp $ */ +/* $OpenBSD: kerberos.c,v 1.13 1998/07/13 19:57:19 art Exp $ */ /* $KTH: kerberos.c,v 1.70 1997/09/26 18:06:38 joda Exp $ */ /* @@ -777,10 +777,15 @@ main(int argc, char **argv) printf("\tLog file is %s\n", log_file); kset_logfile(log_file); - - /* find our hostname, and use it as the instance */ - if (gethostname(k_instance, INST_SZ)) - err (1, "gethostname"); + + { + char hostname[MAXHOSTNAMELEN]; + /* find our hostname, and use it as the instance */ + if (gethostname(hostname, sizeof(hostname))) + err (1, "gethostname"); + strncpy(k_instance, hostname, sizeof(k_instance) - 1); + k_instance[sizeof(k_instance) - 1] = '\0'; + } make_sockets(port_spec, i_flag ? &i_addr : NULL, &fds, &nfds); |