From: Theodore Tso Date: Sat, 14 Feb 1998 03:24:40 +0000 (+0000) Subject: Applied lxs's changes to make ftpd safe for systems where X-Git-Tag: krb5-1.1-beta1~817 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9cb15d118e17697d8b969a05b1065f20a4c84aff;p=krb5.git Applied lxs's changes to make ftpd safe for systems where sizeof(off_t) > sizeof(int). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10456 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/gssftp/ftpd/ChangeLog b/src/appl/gssftp/ftpd/ChangeLog index 5794fc728..a635851fa 100644 --- a/src/appl/gssftp/ftpd/ChangeLog +++ b/src/appl/gssftp/ftpd/ChangeLog @@ -1,3 +1,8 @@ +Fri Feb 13 22:23:34 1998 Theodore Y. Ts'o + + * ftpd.c: Applied lxs's changes to make ftpd safe for systems + where sizeof(off_t) > sizeof(int). + Fri Feb 13 15:31:46 1998 Theodore Ts'o * Makefile.in (thisconfigdir), configure.in: Point the diff --git a/src/appl/gssftp/ftpd/ftpd.c b/src/appl/gssftp/ftpd/ftpd.c index d3d785522..68668faae 100644 --- a/src/appl/gssftp/ftpd/ftpd.c +++ b/src/appl/gssftp/ftpd/ftpd.c @@ -204,7 +204,18 @@ int swaitmax = SWAITMAX; int swaitint = SWAITINT; void lostconn(), myoob(); -FILE *getdatasock(), *dataconn(); +FILE *getdatasock(); +#if defined(__STDC__) +/* + * The following prototypes must be ANSI for systems for which + * sizeof(off_t) > sizeof(int) to prevent stack overflow problems + */ +FILE *dataconn(char *name, off_t size, char *mode); +void send_data(FILE *instr, FILE *outstr, off_t blksize); +#else +void send_data(); +FILE *dataconn(); +#endif #ifdef SETPROCTITLE char **Argv = NULL; /* pointer to argument vector */ @@ -1052,7 +1063,8 @@ dataconn(name, size, mode) file_size = size; byte_count = 0; if (size != (off_t) -1) - (void) sprintf (sizebuf, " (%ld bytes)", size); + /* cast size to long in case sizeof(off_t) > sizeof(long) */ + (void) sprintf (sizebuf, " (%ld bytes)", (long)size); else (void) strcpy(sizebuf, ""); if (pdata >= 0) { @@ -1142,7 +1154,7 @@ secure_error(fmt, p1, p2, p3, p4, p5) * * NB: Form isn't handled. */ -send_data(instr, outstr, blksize) +void send_data(instr, outstr, blksize) FILE *instr, *outstr; off_t blksize; {