commit 13e73cddc715f404e095e91a29f2bf497e5a5221
parent 85811f0d369d8cb4a436bfbae70e5859b676f5d3
Author: ukai <ukai>
Date: Fri, 13 Dec 2002 00:09:50 +0000
[w3m-dev 03563] Directory Traversal Vulnerabilities in FTP Clients
* file.c (guess_save_name): pass guess_filename
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,10 @@
2002-12-13 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03563] Directory Traversal Vulnerabilities in FTP Clients
+ * file.c (guess_save_name): pass guess_filename
+
+2002-12-13 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03562] #undef BUFINFO
* config.h.dist (BUFINFO): undef
* configure (use_bufinfo): n
diff --git a/file.c b/file.c
@@ -7832,16 +7832,14 @@ guess_save_name(Buffer *buf, char *path)
char *p, *q;
if ((p = checkHeader(buf, "Content-Disposition:")) != NULL &&
(q = strcasestr(p, "filename")) != NULL &&
- (q == p || IS_SPACE(*(q - 1)) || *(q - 1) == ';')) {
- if (matchattr(q, "filename", 8, &name))
- return name->ptr;
- }
- if ((p = checkHeader(buf, "Content-Type:")) != NULL &&
+ (q == p || IS_SPACE(*(q - 1)) || *(q - 1) == ';') &&
+ matchattr(q, "filename", 8, &name))
+ path = name->ptr;
+ else if ((p = checkHeader(buf, "Content-Type:")) != NULL &&
(q = strcasestr(p, "name")) != NULL &&
- (q == p || IS_SPACE(*(q - 1)) || *(q - 1) == ';')) {
- if (matchattr(q, "name", 4, &name))
- return name->ptr;
- }
+ (q == p || IS_SPACE(*(q - 1)) || *(q - 1) == ';') &&
+ matchattr(q, "name", 4, &name))
+ path = name->ptr;
}
return guess_filename(path);
}