From 223ad0e8aa5aad8ccd695c250a0efe0ac7c0358c Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 27 Jun 2016 14:38:51 +0200 Subject: [PATCH] conf: fix parsing of refclock directive Don't accept refclock directive which has as the last argument an option that requires a value. --- conf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/conf.c b/conf.c index 5afd6b1..5d31091 100644 --- a/conf.c +++ b/conf.c @@ -692,9 +692,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; @@ -752,10 +752,9 @@ parse_refclock(char *line) other_parse_error("Invalid refclock option"); return; } - line += n; } - if (*line) { + if (*cmd) { command_parse_error(); return; }