]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
conf: fix parsing of refclock directive
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 27 Jun 2016 12:38:51 +0000 (14:38 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 21 Nov 2016 11:02:51 +0000 (12:02 +0100)
Don't accept refclock directive which has as the last argument an option
that requires a value.

conf.c

diff --git a/conf.c b/conf.c
index 94f4ee1dba91aa95606d55a23a9bee084f44f37a..8470b7ee2755377f93ec81a42dccf6e9c6fb097f 100644 (file)
--- 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;
   }