[Pkg-wmaker-commits] [wmfsm] 51/83: debian/patches: (handle_HOME_errors.patch) Avoid errors related to HOME environment variable.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Sun Aug 23 14:05:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmfsm.
commit c6ad1f5c24d120801b37262e9818ceb086946f93
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Thu Jan 22 14:39:46 2015 -0600
debian/patches: (handle_HOME_errors.patch) Avoid errors related to HOME
environment variable.
---
debian/patches/handle_HOME_errors.patch | 36 +++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 37 insertions(+)
diff --git a/debian/patches/handle_HOME_errors.patch b/debian/patches/handle_HOME_errors.patch
new file mode 100644
index 0000000..d64ee99
--- /dev/null
+++ b/debian/patches/handle_HOME_errors.patch
@@ -0,0 +1,36 @@
+Description: Handle errors related to the HOME environment variable.
+ In particular, if HOME is undefined, then a segmentation fault will occur.
+ Also, if HOME is at least 245 characters, then a buffer overflow will occur.
+ We check for these conditions and exit with an error message instead.
+Author: Doug Torrance <dtorrance at monmouthcollege.edu>
+Last-Update: 2015-01-22
+
+--- a/wmfsm/wmfsm.c
++++ b/wmfsm/wmfsm.c
+@@ -565,6 +565,7 @@
+ {
+ char confFileName[255];
+ char workString[255];
++ char *home;
+ int i, j, exnumberfs = 0;
+ int excluded, finalnumberfs = 0;
+ char *mount_points[100];
+@@ -572,7 +573,17 @@
+ int include = -1;
+ int included = 0;
+
+- strncpy(confFileName, (char *) getenv("HOME"), 245);
++ home = getenv("HOME");
++ if (home == NULL) {
++ fprintf(stderr, "error: HOME must be defined\n");
++ exit(1);
++ }
++ if (strlen(home) > 244) {
++ fprintf(stderr,
++ "error: HOME may not be longer than 244 characters\n");
++ exit(1);
++ }
++ strncpy(confFileName, home, 245);
+ strcat(confFileName, "/.wmfsmrc");
+ confFile = fopen(confFileName, "r");
+ if (confFile) {
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..0534357
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+handle_HOME_errors.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmfsm.git
More information about the Pkg-wmaker-commits
mailing list