Package: autocutsel Version: 0.9.0-2 Severity: important Tags: patch If I run "cutsel cut" when the cut buffer is empty, it fails with segmentation fault. Looks like XFetchBuffer() returns NULL pointer in this case, and we are trying to dereference by printing the value. Checking the length for non-zero value before printing is one way to avoid that, implemented by attached patch.
On a related (minor) note, cutsel's man page does not mention the "targets" and "length" subcommands, which are implemented by the binary. -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.11-1-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages autocutsel depends on: ii libc6 2.17-93 ii libice6 2:1.0.8-2 ii libsm6 2:1.2.1-2 ii libx11-6 2:1.6.2-1 ii libxaw7 2:1.0.11-1 ii libxext6 2:1.3.2-1 ii libxmu6 2:1.1.1-1 ii libxt6 1:1.1.4-1 autocutsel recommends no packages. autocutsel suggests no packages. -- no debconf information
diff -aur a/cutsel.c b/cutsel.c --- a/cutsel.c 2006-11-05 09:25:50.000000000 +0000 +++ b/cutsel.c 2013-10-26 17:34:57.383765419 +0100 @@ -213,7 +213,8 @@ XtAppAddTimeOut(context, 10, Exit, 0); } else { options.value = XFetchBuffer(dpy, &options.length, buffer); - printf("%s\n", options.value); + if (options.length) + printf("%s\n", options.value); exit(0); } } else if (strcmp(argv[1], "sel") == 0) {