Package: coreutils
Version: 8.21-1
Severity: normal

Hi,

when ln is run with --relative --symbolic and and empty string as the
target, it ungracefully dies with a segmentation fault. The memory
violation appears to happen in src/relpath.c:38 when the two input paths
are checked for leading slashes:

  if ((path1[1] == '/') != (path2[1] == '/'))

How to reproduce:
[1] Open a terminal
[2] run: ln -sr '' foobar

Result: segmentation fault  ln -sr '' foobar
Expected result: Some kind of error message

Trace:

#0  0x0000000000403370 in path_common_prefix (path1=0x611030 "/root", 
path2=0x0) at src/relpath.c:38
#1  0x00000000004034fe in relpath (can_fname=0x0, can_reldir=0x611030 "/root", 
buf=0x611050 "", len=4096) at src/relpath.c:93
#2  0x0000000000402003 in convert_abs_rel (from=0x7fffffffe3df "", 
target=0x7fffffffe3e0 "foobar") at src/ln.c:144
#3  0x00000000004025ca in do_link (source=0x7fffffffe3df "", 
dest=0x7fffffffe3e0 "foobar") at src/ln.c:284
#4  0x000000000040331c in main (argc=4, argv=0x7fffffffe108) at src/ln.c:631

cheers,

  erik


-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

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

Versions of packages coreutils depends on:
ii  libacl1      2.2.52-1
ii  libattr1     1:2.4.47-1
ii  libc6        2.17-97
ii  libselinux1  2.2.2-1

coreutils recommends no packages.

coreutils suggests no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to