diff options
| author | lukem <lukem@NetBSD.org> | 2000-04-13 08:17:56 +0000 |
|---|---|---|
| committer | lukem <lukem@NetBSD.org> | 2000-04-13 08:17:56 +0000 |
| commit | d54eded2a0fa38a4aa7ae2cb5267e554cd580e2b (patch) | |
| tree | fe93b57587d3f62fe6e380e61fcb37fedc7f73d7 /usr.bin | |
| parent | 031f2ed4b1086ba336a438dbebdcae0206b32ad0 (diff) | |
fixes from cgd:
* sanity check a length (otherwise certain bogus responses can crash ftp)
* allow a transfer encoding type of `binary'; certain firewall vendors
return this bogus type...
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/ftp/fetch.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c index be1c28e161d..ffe2d28559d 100644 --- a/usr.bin/ftp/fetch.c +++ b/usr.bin/ftp/fetch.c @@ -1,4 +1,4 @@ -/* $NetBSD: fetch.c,v 1.108 2000/04/13 08:13:31 lukem Exp $ */ +/* $NetBSD: fetch.c,v 1.109 2000/04/13 08:17:56 lukem Exp $ */ /*- * Copyright (c) 1997-1999 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: fetch.c,v 1.108 2000/04/13 08:13:31 lukem Exp $"); +__RCSID("$NetBSD: fetch.c,v 1.109 2000/04/13 08:17:56 lukem Exp $"); #endif /* not lint */ /* @@ -628,6 +628,8 @@ fetch_url(url, proxyenv, proxyauth, wwwauth) continue; } plen = strlen(cp); + if (hlen < plen) + continue; if (strncasecmp(host + hlen - plen, cp, plen) == 0) { isproxy = 0; @@ -1000,6 +1002,12 @@ fetch_url(url, proxyenv, proxyauth, wwwauth) } else if (strncasecmp(cp, TRANSENC, sizeof(TRANSENC) - 1) == 0) { cp += sizeof(TRANSENC) - 1; + if (strcasecmp(cp, "binary") == 0) { + warnx( + "Bogus transfer encoding - `%s' (fetching anyway)", + cp); + continue; + } if (strcasecmp(cp, "chunked") != 0) { warnx( "Unsupported transfer encoding - `%s'", |
