diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2012-04-23 21:22:03 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2012-04-23 21:22:03 +0000 |
commit | a623e17d6a09e634b929517f5374f8bc5d643e0f (patch) | |
tree | 3eb3af315853e1d778be932f4d9c62e57a488407 /usr.bin | |
parent | 4876a19bdba93d6689353f355a26b6409baa69df (diff) |
Handle HTTP Content-Length headers with trailing whitespace. ok martynas@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ftp/fetch.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c index 9dd8489234a..bfa1b822a7c 100644 --- a/usr.bin/ftp/fetch.c +++ b/usr.bin/ftp/fetch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fetch.c,v 1.103 2010/08/25 20:32:37 martynas Exp $ */ +/* $OpenBSD: fetch.c,v 1.104 2012/04/23 21:22:02 sthen Exp $ */ /* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */ /*- @@ -746,7 +746,10 @@ again: cp = buf; #define CONTENTLEN "Content-Length: " if (strncasecmp(cp, CONTENTLEN, sizeof(CONTENTLEN) - 1) == 0) { + size_t s; cp += sizeof(CONTENTLEN) - 1; + if (s=strcspn(cp, " \t")) + *(cp+s) = 0; filesize = strtonum(cp, 0, LLONG_MAX, &errstr); if (errstr != NULL) goto improper; |