]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3100] ntpq can't retrieve daemon_version
authorJuergen Perlinger <perlinger@ntp.org>
Sun, 21 Aug 2016 07:29:00 +0000 (09:29 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Sun, 21 Aug 2016 07:29:00 +0000 (09:29 +0200)
 (extended sysvar lookup bug, introduced with fix for bug 3008)

bk: 57b9583c4ZJTTde3dC8E5v-eiu1xjA

ChangeLog
ntpd/ntp_control.c

index 0805467dc6b9b1ce7768a039f6a2d87af37546b9..008b9c9f863f54f6c525af0c6ee35e8d9e4d485f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+---
+* [Bug 3100] ntpq can't retrieve daemon_version <perlinger@ntp.org>
+  - fixed extended sysvar lookup (bug introduced with bug 3008 fix)
+
 ---
 (4.2.8p8) 2016/06/02 Released by Harlan Stenn <stenn@ntp.org>
 
index 07b5697f1536605efed3f4ee726d21ee94a59a70..acfb3b643ad38a76102a7a76adecea7a1c579061 100644 (file)
@@ -3158,15 +3158,21 @@ ctl_getitem(
 
        for (v = var_list; !(EOV & v->flags); ++v)
                if (!(PADDING & v->flags)) {
-                       /* check if the var name matches the buffer */
+                       /* Check if the var name matches the buffer. The
+                        * name is bracketed by [reqpt..tp] and not NUL
+                        * terminated, and it contains no '=' char. The
+                        * lookup value IS NUL-terminated but might
+                        * include a '='... We have to look out for
+                        * that!
+                        */
                        const char *sp1 = reqpt;
                        const char *sp2 = v->text;
-                       
-                       while ((sp1 != tp) && *sp2 && (*sp1 == *sp2)) {
+
+                       while ((sp1 != tp) && (*sp1 == *sp2)) {
                                ++sp1;
                                ++sp2;
                        }
-                       if (sp1 == tp && !*sp2)
+                       if (sp1 == tp && (*sp2 == '\0' || *sp2 == '='))
                                break;
                }