From: Juergen Perlinger Date: Tue, 10 Apr 2018 06:10:56 +0000 (+0200) Subject: [Bug 3479] ctl_putrefid() allows unsafe characters through to ntpq X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19cf8b718ea8e4651e3f6dd548248eb71b774704;p=thirdparty%2Fntp.git [Bug 3479] ctl_putrefid() allows unsafe characters through to ntpq bk: 5acc5570TOWAWptWw2cbFlHMnXAEqQ --- diff --git a/ChangeLog b/ChangeLog index a59c68a6a..8aa54c09a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * [Bug 3480] Refclock sample filter not cleared on clock STEP - applied patch by Gerry Garvey +* [Bug 3479] ctl_putrefid() allows unsafe characters through to ntpq + - 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 diff --git a/ntpd/ntp_control.c b/ntpd/ntp_control.c index 9a4273271..faa0751c8 100644 --- a/ntpd/ntp_control.c +++ b/ntpd/ntp_control.c @@ -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); }