[Pkg-wmaker-commits] [wmppp.app] 72/120: wmgeneral: Fix segfault if newline encountered in parse_rcfile.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 27 12:04:37 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmppp.app.
commit c2c3521068f84ae55e906e39fb5db329cf0751c1
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Tue May 19 22:30:54 2015 -0500
wmgeneral: Fix segfault if newline encountered in parse_rcfile.
From a patch for wmppp.app by Chris Gray <cgray at tribsoft.com> submitted to
Debian to fix several bugs [1].
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=27997
---
wmgeneral/wmgeneral.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/wmgeneral/wmgeneral.c b/wmgeneral/wmgeneral.c
index ace55a4..436b196 100644
--- a/wmgeneral/wmgeneral.c
+++ b/wmgeneral/wmgeneral.c
@@ -28,6 +28,9 @@
10/10/2003 (Simon Law, sfllaw at debian.org)
* changed the parse_rcfile function to use getline instead of
fgets.
+ 10/14/2000 (Chris Gray, cgray at tribsoft.com)
+ * Removed a bug from parse_rcfile. An extra
+ newline would cause a segfault.
14/09/1998 (Dave Clark, clarkd at skyia.com)
* Updated createXBMfromXPM routine
* Now supports >256 colors
@@ -128,6 +131,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
+ if(!q)
+ continue;
while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) {
int i;
@@ -135,7 +140,7 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p = strstr(temp, keys[key].label);
p += strlen(keys[key].label);
p += strspn(p, tokens);
- if ((i = strcspn(p, "#\n"))) p[i] = 0;
+ if ((i = strcspn(p, "#\n"))) p[i] = '\0';
free(*keys[key].var);
*keys[key].var = strdup(p);
key = -1;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmppp.app.git
More information about the Pkg-wmaker-commits
mailing list