Skip to content

Commit

Permalink
dmtcp: fix buffer overflow due to too long ld-linux.so path
Browse files Browse the repository at this point in the history
fixes #29565
  • Loading branch information
globin committed Sep 19, 2017
1 parent d63b59a commit 5c18c55
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkgs/os-specific/linux/dmtcp/default.nix
Expand Up @@ -13,15 +13,14 @@ stdenv.mkDerivation rec {

dontDisableStatic = true;

patches = [ ./ld-linux-so-buffer-size.patch ];

postPatch = ''
patchShebangs .
substituteInPlace configure \
--replace '#define ELF_INTERPRETER "$interp"' \
"#define ELF_INTERPRETER \"$(cat $NIX_CC/nix-support/dynamic-linker)\""
'';

preConfigure = ''
substituteInPlace src/dmtcp_coordinator.cpp \
--replace /bin/bash ${stdenv.shell}
substituteInPlace util/gdb-add-symbol-file \
Expand Down
11 changes: 11 additions & 0 deletions pkgs/os-specific/linux/dmtcp/ld-linux-so-buffer-size.patch
@@ -0,0 +1,11 @@
--- dmtcp-2.5.1-src/src/util_exec.cpp 2017-09-19 13:36:22.947587034 +0200
+++ dmtcp-2.5.1-src/src/util_exec.cpp 2017-09-19 13:36:32.221313460 +0200
@@ -178,7 +178,7 @@

static string ld_linux_so_path(int version, bool is32bitElf = false)
{
- char buf[80];
+ char buf[128];
#if (defined(__x86_64__) || defined(__aarch64__)) && !defined(CONFIG_M32)
if (is32bitElf) {
sprintf(buf, "/lib/ld-linux.so.%d", version);

0 comments on commit 5c18c55

Please sign in to comment.