]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
higher.c: don't try to parse comments in hosts
authorPhilip Paeps <philip@trouble.is>
Mon, 25 Apr 2016 06:55:00 +0000 (12:25 +0530)
committerWillem Toorop <willem@nlnetlabs.nl>
Tue, 26 Apr 2016 10:37:40 +0000 (12:37 +0200)
A '#' in a line in /etc/hosts indicates the beginning of a comment and
any further characters until the end of the line should not be parsed.

higher.c

index 528283ce886f522e22a4754148894f689c9b33ae..4ca347b439a9c676ee0aca0473d5726f4b23a8cf 100644 (file)
--- a/higher.c
+++ b/higher.c
@@ -216,6 +216,9 @@ ldns_get_rr_list_hosts_frm_fp_l(FILE *fp, int *line_nr)
                                }
                                (void)strlcpy(addr, word, LDNS_MAX_LINELEN+1);
                        } else {
+                               /* Stop parsing line when a comment begins. */
+                               if (word[0] == '#')
+                                       break;
                                /* la al la la */
                                if (ip6) {
                                        snprintf(rr_str, LDNS_MAX_LINELEN,