chiark / gitweb /
resolv.conf option parsing: Fix word separation
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Oct 2014 11:17:17 +0000 (11:17 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Oct 2014 11:45:59 +0000 (11:45 +0000)
commit494a270b1a3cd50363a2f74331ced01accb54d7a
tree10614a3716e213871f4b2f7212a4b88ea7f2de65
parent795e3902b12f7c52095c673a11db5b6f7a67bbf5
resolv.conf option parsing: Fix word separation

`nextword' does not nul-terminate the words it returns.  So the
strcmps in ccf_options are wrong.  Fix this as follows:

 * Abolish most uses of l in favour of a pointer variable endword.
 * Have OPTION_IS and OPTION_STARTS update word, and endword, so
   that it is convenient to use them for option values, etc.
 * Save the whole option in new variables opt and optend for
   reporting and to assist the `adns_af:' loop.
 * Use OPTION_IS, OPTION_STARTS and memchr, rather than strcmp,
   ad-hoc memcmp, and strcspn.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/setup.c