Fix segfault
authorMarius Gavrilescu <marius@ieval.ro>
Thu, 11 Jul 2013 07:59:00 +0000 (10:59 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Thu, 11 Jul 2013 07:59:00 +0000 (10:59 +0300)
debian/patches/do-not-assume-environment-contains-display.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/do-not-assume-environment-contains-display.patch b/debian/patches/do-not-assume-environment-contains-display.patch
new file mode 100644 (file)
index 0000000..904538b
--- /dev/null
@@ -0,0 +1,27 @@
+Description: Do not assume that the environment contains a DISPLAY variable
+ Previously, the code unconditionally tried to copy it to a variable.
+ This segfaults when that variable does not exist.
+Author: Marius Gavrilescu <marius@ieval.ro>
+Bug-Debian: http://bugs.debian.org/716500
+Forwarded: https://github.com/jim-rees/xfishtank/issues/5
+Bug: https://github.com/jim-rees/xfishtank/issues/5
+Last-Update: 2013-07-11
+
+--- xfishtank-2.3.orig/xfish.c
++++ xfishtank-2.3/xfish.c
+@@ -171,12 +171,14 @@ int argc;
+ char **argv;
+ {
+     int c, i;
++    const char *display = getenv("DISPLAY");
+     extern int optind;
+     extern char *optarg;
+     extern double atof();
+     pname = argv[0];
+-    strncpy(sname, getenv("DISPLAY"), sizeof(sname) - 1);
++    if(display != NULL)
++    strncpy(sname, display, sizeof(sname) - 1);
+     strcpy(cname, "MediumAquamarine");
+     while ((c = getopt(argc, argv, "dDob:C:c:p:m:f:i:r:s")) != EOF) {
index b25ee7fc317a3bb85b6008e4adbd29c7151cff1d..eb8698d70b24b15f6f2714e3c1094dc7696ba2dc 100644 (file)
@@ -1,2 +1,3 @@
 fix-manpage.patch
 remove-p-argument-from-manpage.patch
+do-not-assume-environment-contains-display.patch
This page took 0.011917 seconds and 4 git commands to generate.