Browse Source

Catch missing EOL at EOF. Closes: #567480

Christoph Biedl 12 years ago
parent
commit
8c23077628
2 changed files with 34 additions and 0 deletions
  1. 33 0
      debian/patches/debian-567480_handle-eol-at-eof.patch
  2. 1 0
      debian/patches/series

+ 33 - 0
debian/patches/debian-567480_handle-eol-at-eof.patch

@@ -0,0 +1,33 @@
+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;

+ 1 - 0
debian/patches/series

@@ -8,3 +8,4 @@ debian-610375_remote-number-support.patch
 debian-692129_pptpd-1.3.4_manage-enobufs.patch
 debian-693136_avoid-binary-trash.patch
 debian-426553_bcrelay-manpage.patch
+debian-567480_handle-eol-at-eof.patch