lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1451846374-2665-2-git-send-email-andreas@fatal.se>
Date:	Sun,  3 Jan 2016 19:39:33 +0100
From:	Andreas Henriksson <andreas@...al.se>
To:	Stephen Hemminger <stephen@...workplumber.org>
Cc:	netdev@...r.kernel.org, Andreas Henriksson <andreas@...al.se>
Subject: [PATCH iproute2 v2 2/2] arpd: fix parsing of unlikely long comments

In case the commented out line was longer than the buffer size,
the remaining part was previously not properly skipped.

With this fix we should now continue ignoring lines starting with #
until we find a newline character.

Signed-off-by: Andreas Henriksson <andreas@...al.se>
---
 misc/arpd.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/misc/arpd.c b/misc/arpd.c
index 700dc50..a4f0f0d 100644
--- a/misc/arpd.c
+++ b/misc/arpd.c
@@ -691,6 +691,7 @@ int main(int argc, char **argv)
 		FILE *fp;
 		struct dbkey k;
 		DBT dbkey, dbdat;
+		int skip_until_eol = 0;
 
 		dbkey.data = &k;
 		dbkey.size = sizeof(k);
@@ -707,8 +708,19 @@ int main(int argc, char **argv)
 			char ipbuf[128];
 			char macbuf[128];
 
-			if (buf[0] == '#')
+			/* skip remaining part of commented outline. */
+			if (skip_until_eol) {
+				if (strrchr(buf, '\n') != NULL)
+					skip_until_eol = 0;
 				continue;
+			}
+
+			/* skip (beginning of) commented out line. */
+			if (buf[0] == '#') {
+				if (strrchr(buf, '\n') == NULL)
+					skip_until_eol = 1;
+				continue;
+			}
 
 			if (sscanf(buf, "%u%s%s", &k.iface, ipbuf, macbuf) != 3) {
 				fprintf(stderr, "Wrong format of input file \"%s\"\n", do_load);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ