Package: faketime
Version: 0.9.5-1
Severity: important
Tags: patch

Hello,

There is logic error in src/faketime.c that causes faketime to damage
the contents of an existing LD_PRELOAD environment variable. The
attached patch fixes it for me:

terceiro@homer:faketime-0.9.5$ dpkg-query --show faketime
faketime  0.9.5-1
terceiro@homer:faketime-0.9.5$ tsocks faketime +1day date
ERROR: ld.so: object '/usr/lib/libtsocks.s' from LD_PRELOAD cannot be 
preloaded: ignored.
Seg Mar 31 18:32:01 BRT 2014
terceiro@homer:faketime-0.9.5$ tsocks ./src/faketime +1day date
Ter Abr  1 18:32:05 BRT 2014

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.13-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages eatmydata depends on:
ii  libc6  2.18-4

eatmydata recommends no packages.

eatmydata suggests no packages.

-- no debconf information

-- 
Antonio Terceiro <[email protected]>
Description: fix handling of existing LD_PRELOAD in environment
 This patch fixes handling of the string length when composing an updated
 LD_PRELOAD that includes both the previous value and the entry for
 libeatmydata.
Author: Antonio Terceiro <[email protected]>

--- faketime-0.9.5.orig/src/faketime.c
+++ faketime-0.9.5/src/faketime.c
@@ -311,7 +311,7 @@ int main (int argc, char **argv)
         ftpl_path = PREFIX "/$LIB/faketime/libfaketime.so.1";
 #endif
       }
-      len = (ld_preload)?strlen(ld_preload):0 + 2 + strlen(ftpl_path);
+      len = (ld_preload)?strlen(ld_preload) + 2 + strlen(ftpl_path):0;
       ld_preload_new = malloc(len);
       snprintf(ld_preload_new, len ,"%s%s%s", (ld_preload)?ld_preload:"",
               (ld_preload)?":":"", ftpl_path);

Attachment: signature.asc
Description: Digital signature

Reply via email to