From: Miroslav Lichvar Date: Mon, 27 Jun 2016 12:38:51 +0000 (+0200) Subject: conf: fix parsing of refclock directive X-Git-Tag: 2.4.1~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78f20f7b3e3c424319a02f12f8d5fc16c90d0932;p=thirdparty%2Fchrony.git conf: fix parsing of refclock directive Don't accept refclock directive which has as the last argument an option that requires a value. --- diff --git a/conf.c b/conf.c index 94f4ee1d..8470b7ee 100644 --- a/conf.c +++ b/conf.c @@ -696,9 +696,9 @@ parse_refclock(char *line) line = CPS_SplitWord(line); param = Strdup(p); - while (*line) { - cmd = line; + for (cmd = line; *cmd; line += n, cmd = line) { line = CPS_SplitWord(line); + if (!strcasecmp(cmd, "refid")) { if (sscanf(line, "%4s%n", (char *)ref, &n) != 1) break; @@ -756,10 +756,9 @@ parse_refclock(char *line) other_parse_error("Invalid refclock option"); return; } - line += n; } - if (*line) { + if (*cmd) { command_parse_error(); return; }