diff --git a/wmSMPmon/wmgeneral/wmgeneral.c b/wmSMPmon/wmgeneral/wmgeneral.c index ace55a4..436b196 100644 --- a/wmSMPmon/wmgeneral/wmgeneral.c +++ b/wmSMPmon/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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; diff --git a/wmckgmail/wmgeneral/wmgeneral.c b/wmckgmail/wmgeneral/wmgeneral.c index ace55a4..436b196 100644 --- a/wmckgmail/wmgeneral/wmgeneral.c +++ b/wmckgmail/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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; diff --git a/wmcpufreq/wmgeneral/wmgeneral.c b/wmcpufreq/wmgeneral/wmgeneral.c index ace55a4..436b196 100755 --- a/wmcpufreq/wmgeneral/wmgeneral.c +++ b/wmcpufreq/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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; diff --git a/wmfsm/wmgeneral/wmgeneral.c b/wmfsm/wmgeneral/wmgeneral.c index ace55a4..436b196 100644 --- a/wmfsm/wmgeneral/wmgeneral.c +++ b/wmfsm/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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; diff --git a/wmifs/wmgeneral/wmgeneral.c b/wmifs/wmgeneral/wmgeneral.c index ace55a4..436b196 100644 --- a/wmifs/wmgeneral/wmgeneral.c +++ b/wmifs/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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; diff --git a/wmitime/wmgeneral/wmgeneral.c b/wmitime/wmgeneral/wmgeneral.c index ace55a4..436b196 100644 --- a/wmitime/wmgeneral/wmgeneral.c +++ b/wmitime/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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; diff --git a/wmkeys/wmgeneral/wmgeneral.c b/wmkeys/wmgeneral/wmgeneral.c index ace55a4..436b196 100644 --- a/wmkeys/wmgeneral/wmgeneral.c +++ b/wmkeys/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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; diff --git a/wmmon/wmgeneral/wmgeneral.c b/wmmon/wmgeneral/wmgeneral.c index ace55a4..436b196 100644 --- a/wmmon/wmgeneral/wmgeneral.c +++ b/wmmon/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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; diff --git a/wmppp.app/wmgeneral/wmgeneral.c b/wmppp.app/wmgeneral/wmgeneral.c index ace55a4..436b196 100644 --- a/wmppp.app/wmgeneral/wmgeneral.c +++ b/wmppp.app/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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; diff --git a/wmsm.app/wmgeneral/wmgeneral.c b/wmsm.app/wmgeneral/wmgeneral.c index ace55a4..436b196 100644 --- a/wmsm.app/wmgeneral/wmgeneral.c +++ b/wmsm.app/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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; diff --git a/wmtime/wmgeneral/wmgeneral.c b/wmtime/wmgeneral/wmgeneral.c index ace55a4..436b196 100644 --- a/wmtime/wmgeneral/wmgeneral.c +++ b/wmtime/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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; diff --git a/wmtz/wmgeneral/wmgeneral.c b/wmtz/wmgeneral/wmgeneral.c index ace55a4..436b196 100644 --- a/wmtz/wmgeneral/wmgeneral.c +++ b/wmtz/wmgeneral/wmgeneral.c @@ -28,6 +28,9 @@ 10/10/2003 (Simon Law, sfllaw@debian.org) * changed the parse_rcfile function to use getline instead of fgets. + 10/14/2000 (Chris Gray, cgray@tribsoft.com) + * Removed a bug from parse_rcfile. An extra + newline would cause a segfault. 14/09/1998 (Dave Clark, clarkd@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;