···11+diff --git a/src/copyin.c b/src/copyin.c
22+index cde911e..032d35f 100644
33+--- a/src/copyin.c
44++++ b/src/copyin.c
55+@@ -1385,6 +1385,8 @@ process_copy_in ()
66+ break;
77+ }
88+99++ if (file_hdr.c_namesize <= 1)
1010++ file_hdr.c_name = xrealloc(file_hdr.c_name, 2);
1111+ cpio_safer_name_suffix (file_hdr.c_name, false, !no_abs_paths_flag,
1212+ false);
1313+1414+diff --git a/src/util.c b/src/util.c
1515+index 6ff6032..2763ac1 100644
1616+--- a/src/util.c
1717++++ b/src/util.c
1818+@@ -1411,7 +1411,10 @@ set_file_times (int fd,
1919+ }
2020+2121+ /* Do we have to ignore absolute paths, and if so, does the filename
2222+- have an absolute path? */
2323++ have an absolute path?
2424++ Before calling this function make sure that the allocated NAME buffer has
2525++ capacity at least 2 bytes to allow us to store the "." string inside. */
2626++
2727+ void
2828+ cpio_safer_name_suffix (char *name, bool link_target, bool absolute_names,
2929+ bool strip_leading_dots)
+4
pkgs/tools/archivers/cpio/default.nix
···1919 + "CVE-2015-1197-cpio-2.12.patch";
2020 sha256 = "0ph43m4lavwkc4gnl5h9p3da4kb1pnhwk5l2qsky70dqri8pcr8v";
2121 })
2222+2323+ # Report: http://www.openwall.com/lists/oss-security/2016/01/19/4
2424+ # Patch from https://lists.gnu.org/archive/html/bug-cpio/2016-01/msg00005.html
2525+ ./CVE-2016-2037-out-of-bounds-write.patch
2226 ];
23272428 preConfigure = if stdenv.isCygwin then ''