[Pkg-wmaker-commits] [wmclockmon.git] 27/31: debian/patches/check_free.patch: New patch; avoid crash if memory is freed without being allocated.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Wed Feb 17 10:49:50 UTC 2016


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

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

commit 0cf14b0e7c4ab5afbea1d80f9432eb014f48e2fe
Author: Doug Torrance <dtorrance at piedmont.edu>
Date:   Tue Feb 16 23:08:53 2016 -0500

    debian/patches/check_free.patch: New patch; avoid crash if memory is freed
    without being allocated.
---
 debian/patches/check_free.patch | 44 +++++++++++++++++++++++++++++++++++++++++
 debian/patches/series           |  1 +
 2 files changed, 45 insertions(+)

diff --git a/debian/patches/check_free.patch b/debian/patches/check_free.patch
new file mode 100644
index 0000000..e00d3b2
--- /dev/null
+++ b/debian/patches/check_free.patch
@@ -0,0 +1,44 @@
+Description: Check whether memory has been allocated before freeing.
+ Two strings, command and light_color, were always freed even though they
+ were only conditionally allocated.  This could cause "munmap_chunk(): invalid
+ pointer" errors.  We fix this by keeping track of whether they have been
+ allocated and only freeing if they have.
+Author: Doug Torrance <dtorrance at piedmont.edu>
+Last-Update: 2016-02-16
+
+--- a/wmclockmon-config/actions.c
++++ b/wmclockmon-config/actions.c
+@@ -21,9 +21,11 @@
+ 
+ 
+ void quit_app() {
+-    FREE(command);
++    if (free_command)
++        FREE(command);
+     FREE(config_file);
+-    FREE(light_color);
++    if (free_light_color)
++	FREE(light_color);
+     free_alrm(&alarms);
+     gtk_main_quit();
+ }
+--- a/wmclockmon-config/tools.c
++++ b/wmclockmon-config/tools.c
+@@ -139,6 +139,7 @@
+             printf("Unable to open configuration file \"%s\".\n", config_file);
+         return;
+     }
++    free_light_color = free_command = 0;
+     while (! feof(file)) {
+         memset(line, 0, MAXSTRLEN + 1);
+         fgets(line, MAXSTRLEN, file);
+--- a/wmclockmon-config/variables.h
++++ b/wmclockmon-config/variables.h
+@@ -22,5 +22,7 @@
+ char  *command;
+ char  *msgcmd;
+ Alarm *alarms;
++int    free_light_color;
++int    free_command;
+ 
+ #endif
diff --git a/debian/patches/series b/debian/patches/series
index 1f8fdd6..3031e1c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ kfreebsd_build.patch
 update_autotools.patch
 build_against_gtk2.patch
 fix_typos.patch
+check_free.patch

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



More information about the Pkg-wmaker-commits mailing list