diff options
author | 2012-04-23 21:22:02 +0000 | |
---|---|---|
committer | 2012-04-23 21:22:02 +0000 | |
commit | f90a3fae43357e742eb705548bebc22bc2aa97f6 (patch) | |
tree | 6d1f662dd7687836b398f2500cc36d8ee061c211 | |
parent | When handling SIGFPE, do the `advance pc if exception is a fault (as opposed (diff) | |
download | wireguard-openbsd-f90a3fae43357e742eb705548bebc22bc2aa97f6.tar.xz wireguard-openbsd-f90a3fae43357e742eb705548bebc22bc2aa97f6.zip |
Handle HTTP Content-Length headers with trailing whitespace. ok martynas@
-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; |