diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-06-30 16:00:30 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-06-30 16:00:30 +0000 |
commit | b643bb9badf4a995d989b8daf3e33ba8ee6ffda2 (patch) | |
tree | 87720e8aa60a5b4230d0072dfd2b3d422d7dd1cd /usr.bin/ftp | |
parent | 46239127052c30fac93140fbe021cdd151fdac8a (diff) |
warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant). These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).
Diffstat (limited to 'usr.bin/ftp')
-rw-r--r-- | usr.bin/ftp/fetch.c | 6 | ||||
-rw-r--r-- | usr.bin/ftp/ftp.c | 10 |
2 files changed, 9 insertions, 7 deletions
diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c index 6b887364eb8..bc307e5f862 100644 --- a/usr.bin/ftp/fetch.c +++ b/usr.bin/ftp/fetch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fetch.c,v 1.32 2000/05/25 16:09:26 itojun Exp $ */ +/* $OpenBSD: fetch.c,v 1.33 2000/06/30 16:00:15 millert Exp $ */ /* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */ /*- @@ -38,7 +38,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: fetch.c,v 1.32 2000/05/25 16:09:26 itojun Exp $"; +static char rcsid[] = "$OpenBSD: fetch.c,v 1.33 2000/06/30 16:00:15 millert Exp $"; #endif /* not lint */ /* @@ -338,7 +338,7 @@ again: } freeaddrinfo(res0); if (s < 0) { - warn(cause); + warn("%s", cause); goto cleanup_url_get; } diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c index a29bbe1ffea..0e360768ff8 100644 --- a/usr.bin/ftp/ftp.c +++ b/usr.bin/ftp/ftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftp.c,v 1.37 2000/06/27 00:19:16 fgsch Exp $ */ +/* $OpenBSD: ftp.c,v 1.38 2000/06/30 16:00:14 millert Exp $ */ /* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */ /* @@ -67,7 +67,7 @@ #if 0 static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94"; #else -static char rcsid[] = "$OpenBSD: ftp.c,v 1.37 2000/06/27 00:19:16 fgsch Exp $"; +static char rcsid[] = "$OpenBSD: ftp.c,v 1.38 2000/06/30 16:00:14 millert Exp $"; #endif #endif /* not lint */ @@ -165,7 +165,7 @@ hookup(host, port) error = getaddrinfo(host, pbuf, &hints, &res0); } if (error) { - warn(gai_strerror(error)); + warn("%s", gai_strerror(error)); code = -1; return (0); } @@ -216,7 +216,7 @@ hookup(host, port) break; } if (s < 0) { - warn(cause); + warn("%s", cause); code = -1; freeaddrinfo(res0); return 0; @@ -1276,6 +1276,8 @@ reinit: * What we've got at this point is a string of comma separated * one-byte unsigned integer values, separated by commas. */ + if (!pasvcmd) + goto bad; if (strcmp(pasvcmd, "PASV") == 0) { if (data_addr.su_family != AF_INET) { fputs( |