Fix segfault
[xfishtank.git] / debian / patches / do-not-assume-environment-contains-display.patch
1 Description: Do not assume that the environment contains a DISPLAY variable
2 Previously, the code unconditionally tried to copy it to a variable.
3 This segfaults when that variable does not exist.
4 Author: Marius Gavrilescu <marius@ieval.ro>
5 Bug-Debian: http://bugs.debian.org/716500
6 Forwarded: https://github.com/jim-rees/xfishtank/issues/5
7 Bug: https://github.com/jim-rees/xfishtank/issues/5
8 Last-Update: 2013-07-11
9
10 --- xfishtank-2.3.orig/xfish.c
11 +++ xfishtank-2.3/xfish.c
12 @@ -171,12 +171,14 @@ int argc;
13 char **argv;
14 {
15 int c, i;
16 + const char *display = getenv("DISPLAY");
17 extern int optind;
18 extern char *optarg;
19 extern double atof();
20
21 pname = argv[0];
22 - strncpy(sname, getenv("DISPLAY"), sizeof(sname) - 1);
23 + if(display != NULL)
24 + strncpy(sname, display, sizeof(sname) - 1);
25 strcpy(cname, "MediumAquamarine");
26
27 while ((c = getopt(argc, argv, "dDob:C:c:p:m:f:i:r:s")) != EOF) {
This page took 0.022423 seconds and 4 git commands to generate.