diff options
author | simon <simon@FreeBSD.org> | 2005-03-09 06:53:02 +0000 |
---|---|---|
committer | simon <simon@FreeBSD.org> | 2005-03-09 06:53:02 +0000 |
commit | f47a6f11e316ba6a278c47f2132eb41750a7672e (patch) | |
tree | b14f1c5d9c1d590d406e4a88a950e30613bfc991 /ftp/wget | |
parent | c79bd3f72231296b21ac848c3c46d19bc94965a9 (diff) | |
download | FreeBSD-ports-f47a6f11e316ba6a278c47f2132eb41750a7672e.zip FreeBSD-ports-f47a6f11e316ba6a278c47f2132eb41750a7672e.tar.gz |
Fix directory traversal vulnerability.
Security: CAN-2004-1487
Security: http://vuxml.FreeBSD.org/06f142ff-4df3-11d9-a9e7-0001020eed82.html
(part of)
Obtained from: SuSE
Approved by: sf (maintainer), erwin (mentor)
Diffstat (limited to 'ftp/wget')
-rw-r--r-- | ftp/wget/Makefile | 2 | ||||
-rw-r--r-- | ftp/wget/files/patch-CAN-2004-1487 | 51 |
2 files changed, 52 insertions, 1 deletions
diff --git a/ftp/wget/Makefile b/ftp/wget/Makefile index 18f1bbe..b99e64b 100644 --- a/ftp/wget/Makefile +++ b/ftp/wget/Makefile @@ -10,7 +10,7 @@ PORTNAME= wget PORTVERSION= 1.8.2 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= ftp www ipv6 MASTER_SITES= ${MASTER_SITE_GNU} MASTER_SITE_SUBDIR= wget diff --git a/ftp/wget/files/patch-CAN-2004-1487 b/ftp/wget/files/patch-CAN-2004-1487 new file mode 100644 index 0000000..d37947a --- /dev/null +++ b/ftp/wget/files/patch-CAN-2004-1487 @@ -0,0 +1,51 @@ +diff -ruN wget-LFS-20040909/src/http.c wget-LFS-20040909.patched/src/http.c +--- src/http.c.orig 2004-09-09 19:28:26.000000000 -0700 ++++ src/http.c 2005-02-21 04:13:05.000000000 -0800 +@@ -1719,6 +1719,7 @@ + /* Open the local file. */ + if (!output_stream) + { ++ sanitize_path(*hs->local_file); + mkalldirs (*hs->local_file); + if (opt.backups) + rotate_backups (*hs->local_file); +diff -ruN wget-LFS-20040909/src/utils.c wget-LFS-20040909.patched/src/utils.c +--- src/utils.c.orig 2004-09-09 13:32:07.000000000 -0700 ++++ src/utils.c 2005-02-21 04:11:54.000000000 -0800 +@@ -368,6 +368,25 @@ + #endif + } + ++ ++char * ++sanitize_path(char *path) ++{ ++ char *str = NULL; ++ ++ /* evilhost/../ */ ++ while ((str = strstr(path, "..")) != NULL) ++ memcpy(str, "__", 2); ++ /* evilhost/.bashrc */ ++ while ((str = strstr(path, "/.")) != NULL) ++ str[1] = '_'; ++ /* .bashrc */ ++ if (*path == '.') ++ *path = '_'; ++ return path; ++} ++ ++ + /* Returns 0 if PATH is a directory, 1 otherwise (any kind of file). + Returns 0 on error. */ + int +diff -ruN wget-LFS-20040909/src/utils.h wget-LFS-20040909.patched/src/utils.h +--- src/utils.h.orig 2004-09-09 21:05:36.000000000 -0700 ++++ src/utils.h 2005-02-21 04:04:07.000000000 -0800 +@@ -83,6 +83,7 @@ + int make_directory PARAMS ((const char *)); + char *unique_name PARAMS ((const char *, int)); + char *file_merge PARAMS ((const char *, const char *)); ++char *sanitize_path PARAMS ((char *)); + + int acceptable PARAMS ((const char *)); + int accdir PARAMS ((const char *s, enum accd)); |