getdata: report position in config file when parsing fails

It seems that one can reach the abort() with severely broken configuration
file, that is extremely unlikely to run without parser error when given to
ISC dhcpd.  So such files ought to be impossible, and it is good enough for
this software to report position where parsing cannot be continued.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-01-08 11:49:41 +00:00
parent ae2edb0fbc
commit a905b50943
No known key found for this signature in database
GPG key ID: A9553245FDE9B739

View file

@ -257,8 +257,9 @@ void parse_config(int is_include, const char *restrict config_file,
break;
} else if (argument == ITS_A_RANGE_SECOND_IP && i == 0) {
if (!range_p) {
puts("parse_config: range_p uninitialized: report a bug");
abort();
fpos_t pos;
fgetpos(dhcpd_config, &pos);
error(EXIT_FAILURE, 0, "parse_config: parsing failed at position: %Ld", pos);
}
range_p->last_ip = range_p->first_ip;
goto newrange;