From 7cd754d04eab0796fee90fb5d2fc6d2691799fce Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 16 Dec 1996 17:09:07 +0000 Subject: strncat related oflows --- kerberosIV/krb/getrealm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kerberosIV/krb/getrealm.c') diff --git a/kerberosIV/krb/getrealm.c b/kerberosIV/krb/getrealm.c index 10a3b20610c..45ab920d575 100644 --- a/kerberosIV/krb/getrealm.c +++ b/kerberosIV/krb/getrealm.c @@ -83,9 +83,9 @@ krb_realmofhost(host) if ((trans_file = fopen(KRB_RLM_TRANS, "r")) == (FILE *) 0) { char tbuf[128]; char *tdir = (char *) getenv("KRBCONFDIR"); - strncpy(tbuf, tdir ? tdir : "/etc", sizeof(tbuf)); - strncat(tbuf, "/krb.realms", sizeof(tbuf)); - tbuf[sizeof(tbuf)-1] = 0; + strncpy(tbuf, tdir ? tdir : "/etc", sizeof(tbuf)-1); + tbuf[sizeof(tbuf)-1] = '\0'; + strncat(tbuf, "/krb.realms", sizeof(tbuf) - strlen(tbuf)); if ((trans_file = fopen(tbuf,"r")) == NULL) return(ret_realm[0] ? ret_realm : NULL); /* krb_errno = KRB_NO_TRANS */ } -- cgit v1.2.3