123456789101112131415161718192021222324252627282930313233 |
- Description: Catch missing EOL at EOF
- Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
- Forwarded: http://sourceforge.net/mailarchive/forum.php?thread_name=1360193802%40msgid.manchmal.in-ulm.de&forum_name=poptop-server
- Bug: http://sourceforge.net/p/poptop/bugs/35/
- Bug-Debian: http://bugs.debian.org/567480
- --- a/configfile.c
- +++ b/configfile.c
- @@ -57,14 +57,18 @@
- while ((fgets(buffer, MAX_CONFIG_STRING_SIZE - 1, in)) != NULL) {
- /* ignore long lines */
- if (buffer[(len = strlen(buffer)) - 1] != '\n') {
- - syslog(LOG_ERR, "Long config file line ignored.");
- - do
- - fgets(buffer, MAX_CONFIG_STRING_SIZE - 1, in);
- - while (buffer[strlen(buffer) - 1] != '\n');
- - continue;
- + if (len >= MAX_CONFIG_STRING_SIZE - 2) {
- + syslog(LOG_ERR, "Long config file line ignored.");
- + char *p;
- + do
- + p = fgets(buffer, MAX_CONFIG_STRING_SIZE - 1, in);
- + while (p && buffer[strlen(buffer) - 1] != '\n');
- + continue;
- + }
- + } else {
- + len--; /* For the NL at the end */
- }
-
- - len--; /* For the NL at the end */
- while (--len >= 0)
- if (buffer[len] != ' ' && buffer[len] != '\t')
- break;
|