From 6735c54630c8cd5b0114fa1817be2202b727bc5a Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Sat, 13 Feb 1999 02:12:29 +0000 Subject: [PATCH] * ftpd.c: strcat -> strncat git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11172 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/gssftp/ftpd/ChangeLog | 4 ++++ src/appl/gssftp/ftpd/ftpd.c | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/appl/gssftp/ftpd/ChangeLog b/src/appl/gssftp/ftpd/ChangeLog index 8a0dbc8e0..bf2c78968 100644 --- a/src/appl/gssftp/ftpd/ChangeLog +++ b/src/appl/gssftp/ftpd/ChangeLog @@ -1,3 +1,7 @@ +Fri Feb 12 21:11:18 1999 Tom Yu + + * ftpd.c: strcat -> strncat + 1998-11-13 Theodore Ts'o * Makefile.in: Set the myfulldir and mydir variables (which are diff --git a/src/appl/gssftp/ftpd/ftpd.c b/src/appl/gssftp/ftpd/ftpd.c index db424a597..897a81433 100644 --- a/src/appl/gssftp/ftpd/ftpd.c +++ b/src/appl/gssftp/ftpd/ftpd.c @@ -596,7 +596,8 @@ path_expand(path) } } } - return strcat(pathbuf, path); + return strncat(pathbuf, path, + sizeof (pathbuf) - strlen(pathbuf) - 1); } /* @@ -728,11 +729,13 @@ user(name) #endif /* KRB5_KRB4_COMPAT */ if (!authorized && authlevel == AUTHLEVEL_AUTHORIZE) { - strcat(buf, "; Access denied."); + strncat(buf, "; Access denied.", + sizeof(buf) - strlen(buf) - 1); result = 530; pw = NULL; } else if (!authorized || (want_creds && !have_creds)) { - strcat(buf, "; Password required."); + strncat(buf, "; Password required.", + sizeof(buf) - strlen(buf) - 1); askpasswd = 1; result = 331; } else @@ -1611,7 +1614,7 @@ statcmd() sprintf(&str[strlen(str)], ", FORM: %s", formnames[form]); if (type == TYPE_L) #if 1 - strcat(str, " 8"); + strncat(str, " 8", sizeof (str) - strlen(str) - 1); #else /* this is silly. -- eichin@cygnus.com */ #if NBBY == 8 @@ -1681,7 +1684,7 @@ reply(n, fmt, p0, p1, p2, p3, p4, p5) int length, kerror; if (n) sprintf(in, "%d%c", n, cont_char); else in[0] = '\0'; - strcat(in, buf); + strncat(in, buf, sizeof (in) - strlen(in) - 1); #ifdef KRB5_KRB4_COMPAT if (strcmp(auth_type, "KERBEROS_V4") == 0) { if ((length = clevel == PROT_P ? -- 2.26.2