diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /dev-libs/libtar/files |
reinit the tree, so we can have metadata
Diffstat (limited to 'dev-libs/libtar/files')
-rw-r--r-- | dev-libs/libtar/files/CVE-2013-4420.patch | 94 | ||||
-rw-r--r-- | dev-libs/libtar/files/libtar-1.2.11-free.patch | 22 | ||||
-rw-r--r-- | dev-libs/libtar/files/libtar-1.2.11-impl-dec.patch | 15 |
3 files changed, 131 insertions, 0 deletions
diff --git a/dev-libs/libtar/files/CVE-2013-4420.patch b/dev-libs/libtar/files/CVE-2013-4420.patch new file mode 100644 index 000000000000..d6e24860c929 --- /dev/null +++ b/dev-libs/libtar/files/CVE-2013-4420.patch @@ -0,0 +1,94 @@ +--- a/libtar/lib/decode.c 2013-10-09 09:59:44.000000000 -0700 ++++ b/libtar/lib/decode.c 2015-07-20 20:57:58.331945962 -0700 +@@ -21,24 +21,55 @@ + # include <string.h> + #endif + ++char * ++safer_name_suffix (char const *file_name) ++{ ++ char const *p, *t; ++ p = t = file_name; ++ while (*p) ++ { ++ if (p[0] == '.' && p[0] == p[1] && p[2] == '/') ++ { ++ p += 3; ++ t = p; ++ } ++ /* advance pointer past the next slash */ ++ while (*p && (p++)[0] != '/'); ++ } ++ ++ if (!*t) ++ { ++ t = "."; ++ } ++ ++ if (t != file_name) ++ { ++ /* TODO: warn somehow that the path was modified */ ++ } ++ return (char*)t; ++} ++ + + /* determine full path name */ + char * + th_get_pathname(TAR *t) + { + static TLS_THREAD char filename[MAXPATHLEN]; ++ char *safer_name; + + if (t->th_buf.gnu_longname) +- return t->th_buf.gnu_longname; ++ return safer_name_suffix(t->th_buf.gnu_longname); ++ ++ safer_name = safer_name_suffix(t->th_buf.name); + + if (t->th_buf.prefix[0] != '\0') + { + snprintf(filename, sizeof(filename), "%.155s/%.100s", +- t->th_buf.prefix, t->th_buf.name); ++ t->th_buf.prefix, safer_name); + return filename; + } + +- snprintf(filename, sizeof(filename), "%.100s", t->th_buf.name); ++ snprintf(filename, sizeof(filename), "%.100s", safer_name); + return filename; + } + +--- a/libtar/lib/extract.c 2013-10-09 09:59:44.000000000 -0700 ++++ b/libtar/lib/extract.c 2015-07-20 21:00:16.560956122 -0700 +@@ -305,7 +305,7 @@ + linktgt = &lnp[strlen(lnp) + 1]; + } + else +- linktgt = th_get_linkname(t); ++ linktgt = safer_name_suffix(th_get_linkname(t)); + + #ifdef DEBUG + printf(" ==> extracting: %s (link to %s)\n", filename, linktgt); +@@ -343,9 +343,9 @@ + + #ifdef DEBUG + printf(" ==> extracting: %s (symlink to %s)\n", +- filename, th_get_linkname(t)); ++ filename, safer_name_suffix(th_get_linkname(t))); + #endif +- if (symlink(th_get_linkname(t), filename) == -1) ++ if (symlink(safer_name_suffix(th_get_linkname(t)), filename) == -1) + { + #ifdef DEBUG + perror("symlink()"); +--- a/libtar/lib/internal.h 2013-10-09 09:59:44.000000000 -0700 ++++ b/libtar/lib/internal.h 2015-07-20 21:00:51.258958673 -0700 +@@ -15,6 +15,7 @@ + + #include <libtar.h> + ++char* safer_name_suffix(char const*); + #ifdef TLS + #define TLS_THREAD TLS + #else diff --git a/dev-libs/libtar/files/libtar-1.2.11-free.patch b/dev-libs/libtar/files/libtar-1.2.11-free.patch new file mode 100644 index 000000000000..3a7b028d5d2d --- /dev/null +++ b/dev-libs/libtar/files/libtar-1.2.11-free.patch @@ -0,0 +1,22 @@ +stdlib.h is required for free() + +--- lib/output.c ++++ lib/output.c +@@ -20,6 +20,7 @@ + #include <sys/param.h> + + #ifdef STDC_HEADERS ++# include <stdlib.h> + # include <string.h> + #endif + +--- lib/wrapper.c ++++ lib/wrapper.c +@@ -18,6 +18,7 @@ + #include <errno.h> + + #ifdef STDC_HEADERS ++# include <stdlib.h> + # include <string.h> + #endif + diff --git a/dev-libs/libtar/files/libtar-1.2.11-impl-dec.patch b/dev-libs/libtar/files/libtar-1.2.11-impl-dec.patch new file mode 100644 index 000000000000..ee00f5c1c9f3 --- /dev/null +++ b/dev-libs/libtar/files/libtar-1.2.11-impl-dec.patch @@ -0,0 +1,15 @@ + lib/extract.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/lib/extract.c b/lib/extract.c +index 6bbb801..3ef2fb8 100644 +--- a/lib/extract.c ++++ b/lib/extract.c +@@ -18,6 +18,7 @@ + #include <fcntl.h> + #include <errno.h> + #include <utime.h> ++#include <string.h> + + #ifdef STDC_HEADERS + # include <stdlib.h> |