summaryrefslogtreecommitdiffstats
path: root/libexec/ftpd
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1997-12-24 19:13:23 +0000
committerimp <imp@FreeBSD.org>1997-12-24 19:13:23 +0000
commit2dee7f5729696f2bc9609e2926baa107302af2c1 (patch)
tree08ec52179d282c1b596eed4aba6977eef1e13df6 /libexec/ftpd
parent604bcde61e03e4ca051aae2c87b0f250a3806280 (diff)
downloadFreeBSD-src-2dee7f5729696f2bc9609e2926baa107302af2c1.zip
FreeBSD-src-2dee7f5729696f2bc9609e2926baa107302af2c1.tar.gz
Various sprintf -> snprintf fixes.
Minor style fix (strcpy(foo,"") -> *foo = '\0') Obtained from: OpenBSD(?)
Diffstat (limited to 'libexec/ftpd')
-rw-r--r--libexec/ftpd/ftpd.c16
-rw-r--r--libexec/ftpd/skey-stuff.c5
2 files changed, 12 insertions, 9 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index df735aa..83c1727 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -44,7 +44,7 @@ static char copyright[] =
static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: ftpd.c,v 1.43 1997/11/21 07:38:42 charnier Exp $";
#endif /* not lint */
/*
@@ -483,7 +483,7 @@ main(argc, argv, envp)
data_source.sin_port = htons(ntohs(ctrl_addr.sin_port) - 1);
/* set this here so klogin can use it... */
- (void)sprintf(ttyline, "ftp%d", getpid());
+ (void)snprintf(ttyline, sizeof(ttyline), "ftp%d", getpid());
/* Try to handle urgent data inline */
#ifdef SO_OOBINLINE
@@ -1132,7 +1132,7 @@ retrieve(cmd, name)
} else {
char line[BUFSIZ];
- (void) sprintf(line, cmd, name), name = line;
+ (void) snprintf(line, sizeof(line), cmd, name), name = line;
fin = ftpd_popen(line, "r"), closefunc = ftpd_pclose;
st.st_size = -1;
st.st_blksize = BUFSIZ;
@@ -1333,9 +1333,9 @@ dataconn(name, size, mode)
file_size = size;
byte_count = 0;
if (size != (off_t) -1)
- (void) sprintf(sizebuf, " (%qd bytes)", size);
+ (void) snprintf(sizebuf, sizeof(sizebuf), " (%qd bytes)", size);
else
- (void) strcpy(sizebuf, "");
+ *sizebuf = '\0';
if (pdata >= 0) {
struct sockaddr_in from;
int s, fromlen = sizeof(from);
@@ -2059,7 +2059,8 @@ gunique(local)
}
if (cp)
*cp = '/';
- (void) snprintf(new, sizeof(new), "%s", local);
+ /* -4 is for the .nn<null> we put on the end below */
+ (void) snprintf(new, sizeof(new) - 4, "%s", local);
cp = new + strlen(new);
*cp++ = '.';
for (count = 1; count < 100; count++) {
@@ -2172,7 +2173,8 @@ send_file_list(whichf)
dir->d_namlen == 2)
continue;
- sprintf(nbuf, "%s/%s", dirname, dir->d_name);
+ snprintf(nbuf, sizeof(nbuf),
+ "%s/%s", dirname, dir->d_name);
/*
* We have to do a stat to insure it's
diff --git a/libexec/ftpd/skey-stuff.c b/libexec/ftpd/skey-stuff.c
index 97f1650..30faa9e 100644
--- a/libexec/ftpd/skey-stuff.c
+++ b/libexec/ftpd/skey-stuff.c
@@ -3,7 +3,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id$";
+ "$Id: skey-stuff.c,v 1.10 1997/11/21 07:38:43 charnier Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -24,8 +24,9 @@ int pwok;
/* Display s/key challenge where appropriate. */
+ *buf = '\0';
if (pwd == NULL || skeychallenge(&skey, pwd->pw_name, buf))
- sprintf(buf, "Password required for %s.", name);
+ snprintf(buf, sizeof(buf), "Password required for %s.", name);
else if (!pwok)
strcat(buf, " (s/key required)");
return (buf);
OpenPOWER on IntegriCloud