if ((cnffile = fopen(KRB_CONF,"r")) == NULL) {
char tbuf[128];
char *tdir = (char *) getenv("KRBCONFDIR");
- strncpy(tbuf, tdir ? tdir : "/etc", sizeof(tbuf));
- strncat(tbuf, "/krb.conf", sizeof(tbuf));
+ strncpy(tbuf, tdir ? tdir : "/etc", sizeof(tbuf)-1);
tbuf[sizeof(tbuf)-1] = 0;
+ strncat(tbuf, "/krb.conf", sizeof(tbuf)-strlen(tbuf));
if ((cnffile = fopen(tbuf,"r")) == NULL)
return(KFAILURE);
}
if ((cnffile = fopen(KRB_CONF,"r")) == NULL) {
char tbuf[128];
char *tdir = (char *) getenv("KRBCONFDIR");
- strncpy(tbuf, tdir ? tdir : "/etc", sizeof(tbuf));
- strncat(tbuf, "/krb.conf", sizeof(tbuf));
+ strncpy(tbuf, tdir ? tdir : "/etc", sizeof(tbuf)-1);
tbuf[sizeof(tbuf)-1] = 0;
+ strncat(tbuf, "/krb.conf", sizeof(tbuf)-strlen(tbuf));
if ((cnffile = fopen(tbuf,"r")) == NULL)
return(KFAILURE);
}
if ((cnffile = fopen(KRB_CONF, "r")) == NULL) {
char tbuf[128];
char *tdir = (char *) getenv("KRBCONFDIR");
- strncpy(tbuf, tdir ? tdir : "/etc", sizeof(tbuf));
- strncat(tbuf, "/krb.conf", sizeof(tbuf));
+ strncpy(tbuf, tdir ? tdir : "/etc", sizeof(tbuf)-1);
tbuf[sizeof(tbuf)-1] = 0;
+ strncat(tbuf, "/krb.conf", sizeof(tbuf)-strlen(tbuf));
if ((cnffile = fopen(tbuf,"r")) == NULL)
return(KFAILURE);
}
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 */
}
char password[BUFSIZ];
int passlen;
- strncpy (password, str, sizeof(password));
+ strncpy (password, str, sizeof(password)-1);
+ password[sizeof(password)-1] = '\0';
if ((passlen = strlen (password)) < sizeof(password)-1)
strncat (password, cell, sizeof(password)-passlen);
- if ((passlen = strlen(password)) > sizeof(password)) passlen = sizeof(password);
+ if ((passlen = strlen(password)) > sizeof(password))
+ passlen = sizeof(password);
bcopy ("kerberos", &ivec, 8);
bcopy ("kerberos", &temp_key, 8);