]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3479] ctl_putrefid() allows unsafe characters through to ntpq
authorJuergen Perlinger <perlinger@ntp.org>
Tue, 10 Apr 2018 06:10:56 +0000 (08:10 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Tue, 10 Apr 2018 06:10:56 +0000 (08:10 +0200)
bk: 5acc5570TOWAWptWw2cbFlHMnXAEqQ

ChangeLog
ntpd/ntp_control.c

index a59c68a6a4914c9fb6374975d6fcfe73863f6e45..8aa54c09a78b36c68a8dc583bb5237a04bfdf07e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 
 * [Bug 3480] Refclock sample filter not cleared on clock STEP <perlinger@ntp.org>
   - applied patch by Gerry Garvey
+* [Bug 3479] ctl_putrefid() allows unsafe characters through to ntpq <perlinger@ntp.org>
+  - applied patch by Gerry Garvey (with mods)
 * [Bug 3471] Check for openssl/[ch]mac.h.  HStenn.
   - add #define ENABLE_CMAC support in configure.  HStenn.
 * [Bug 3470] ntpd4.2.8p11 fails to compile without OpenSSL <perlinger@ntp.org>
index 9a4273271157a8fcbf8faf66629653449d480541..faa0751c8ccad0bed534f3770fe1e1d074b13a77 100644 (file)
@@ -1827,7 +1827,9 @@ ctl_putrefid(
 
        bytes.w = refid;
        for (nc = 0; nc < sizeof(bytes.b) && bytes.b[nc]; ++nc)
-               if (!isprint(bytes.b[nc]))
+               if (  !isprint(bytes.b[nc])
+                   || isspace(bytes.b[nc])
+                   || bytes.b[nc] == ','  )
                        bytes.b[nc] = '.';
        ctl_putunqstr(tag, (const char*)bytes.b, nc);
 }