summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2013-07-01 15:01:50 +0200
committerDenys Vlasenko2013-07-01 15:05:09 +0200
commitea267d518ff55517e174b9e8514fc521e4a3b41e (patch)
tree4147db5082f88ee14341de5df48fec5cb7fd513f
parent1bf560e9c374b073757509b334eb099c59f64191 (diff)
downloadbusybox-ea267d518ff55517e174b9e8514fc521e4a3b41e.zip
busybox-ea267d518ff55517e174b9e8514fc521e4a3b41e.tar.gz
wget: do not abort if "_" is encountered in a HTTP header
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/wget.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 4eafebe..ce2f514 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -328,8 +328,16 @@ static char *gethdr(FILE *fp)
return NULL;
/* convert the header name to lower case */
- for (s = G.wget_buf; isalnum(*s) || *s == '-' || *s == '.'; ++s) {
- /* tolower for "A-Z", no-op for "0-9a-z-." */
+ for (s = G.wget_buf; isalnum(*s) || *s == '-' || *s == '.' || *s == '_'; ++s) {
+ /*
+ * No-op for 20-3f and 60-7f. "0-9a-z-." are in these ranges.
+ * 40-5f range ("@A-Z[\]^_") maps to 60-7f.
+ * "A-Z" maps to "a-z".
+ * "@[\]" can't occur in header names.
+ * "^_" maps to "~,DEL" (which is wrong).
+ * "^" was never seen yet, "_" was seen from web.archive.org
+ * (x-archive-orig-x_commoncrawl_Signature: HEXSTRING).
+ */
*s |= 0x20;
}