[Pkg-wmaker-commits] [wmrack] 87/97: debian/patches: (check_home.patch) Avoid segmentation fault when HOME environment variable is undefined (Closes: #716473).

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sat Aug 22 02:42:09 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmrack.

commit 73e5c2f64baefd1e0c8d6a7916bd5c6504192d17
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Mon Dec 29 15:36:26 2014 -0600

    debian/patches: (check_home.patch) Avoid segmentation fault when HOME environment variable is undefined (Closes: #716473).
---
 debian/patches/check_home.patch | 44 +++++++++++++++++++++++++++++++++++++++++
 debian/patches/series           |  1 +
 2 files changed, 45 insertions(+)

diff --git a/debian/patches/check_home.patch b/debian/patches/check_home.patch
new file mode 100644
index 0000000..510da79
--- /dev/null
+++ b/debian/patches/check_home.patch
@@ -0,0 +1,44 @@
+Description: Check if HOME environment variable is defined.
+ If it was not, then a segmentation fault would occur.  Exit with an error
+ message instead.
+Author: Doug Torrance <dtorrance at monmouthcollege.edu>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=716473
+Last-Update: 2014-12-29
+
+--- a/library.c
++++ b/library.c
+@@ -41,9 +41,16 @@
+ char *lib_findfile(char *name, int here)
+ {
+   char path[4096]="";
++  char *home;
+   int i;
+   struct stat st;
+ 
++  home = getenv("HOME");
++  if (home == NULL)
++    {
++      fprintf (stderr, "wmrack: HOME undefined\n");
++      exit (1);
++    }
+   if (here)
+     {
+       strcpy(path,name);
+@@ -54,7 +61,7 @@
+   if (*path==0)
+     for (i=0; lib_personal_path[i]; i++)
+       {
+-	strcpy(path,getenv("HOME"));
++	strcpy(path,home);
+ 	strcat(path,lib_personal_path[i]);
+ 	if (here)
+ 	  {
+@@ -83,7 +90,7 @@
+ 	}
+       if (*path==0)
+ 	{
+-	  strcpy(path,getenv("HOME"));
++	  strcpy(path,home);
+ 	  strcat(path,lib_personal_path[0]);
+ 	  if (mkdir(path,0755))
+ 	    return NULL;
diff --git a/debian/patches/series b/debian/patches/series
index 3b1d86a..266a1f9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@ fix_kfreebsd_ftbfs.patch
 update_makefile.patch
 fix_-Wformat.patch
 fix_expose_loop.patch
+check_home.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmrack.git



More information about the Pkg-wmaker-commits mailing list