]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1643] from 4.2.6p3: Range-check the decoding of the RIPE-NCC status codes
authorHarlan Stenn <stenn@ntp.org>
Sat, 25 Sep 2010 21:11:34 +0000 (21:11 +0000)
committerHarlan Stenn <stenn@ntp.org>
Sat, 25 Sep 2010 21:11:34 +0000 (21:11 +0000)
bk: 4c9e6586UT_wy9DcYoc_eKt7i08ntg

ChangeLog
ntpd/refclock_ripencc.c

index 23e1d149f195ffde12b2a45adc4b117a279b2466..af74322f74458a0c1c321be7430c516b0c6989fb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 * Clock combining algorithm improvements from Dave Mills.
 * Documentation updates from Dave Mills.
 * [Bug 1642] ntpdsim can't find simulate block in config file.
+* [Bug 1643] from 4.2.6p3: Range-check the decoding of the RIPE-NCC status
+  codes.
 (4.2.7p55) 2010/09/22 Released by Harlan Stenn <stenn@ntp.org>
 * Documentation updates from Dave Mills.
 * [Bug 1636] from 4.2.6p3-RC2: segfault after denied remote config.
index 1cba53dc0780bb9db932766c59e000d1501f734b..94a1de46d0dc89b9fe72434e6c17b4fba9b0c664 100644 (file)
@@ -3179,7 +3179,9 @@ static void rpt_rcvr_health (TSIPPKT *rpt)
 {
        unsigned char
                status1, status2;
-       static char
+       const char
+               *text;
+       static const char const
                *sc_text[] = {
                        "Doing position fixes",
                        "Don't have GPS time yet",
@@ -3203,8 +3205,11 @@ static void rpt_rcvr_health (TSIPPKT *rpt)
                return;
        }
 
+       text = (status1 < COUNTOF(sc_text))
+                  ? sc_text[status1]
+                  : "(out of range)";
        pbuf += sprintf(pbuf, "\nRcvr status1: %s (%02Xh); ",
-       sc_text[rpt->buf[0]], status1);
+               text, status1);
 
        pbuf += sprintf(pbuf, "status2: %s, %s (%02Xh)",
                (status2 & 0x01)?"No BBRAM":"BBRAM OK",
@@ -3382,7 +3387,7 @@ static void rpt_operating_parameters (TSIPPKT *rpt)
        pbuf += sprintf(pbuf, "\nOperating Parameters:");
        pbuf += sprintf(pbuf, "\n     Dynamics code = %d %s",
        dyn_code, dyn_text[dyn_code]);
-       pbuf += sprintf(pbuf, "\n     Elevation mask = %.2fΓΈ", el_mask * R2D);
+       pbuf += sprintf(pbuf, "\n     Elevation mask = %.2f?", el_mask * R2D);
        pbuf += sprintf(pbuf, "\n     SNR mask = %.2f", snr_mask);
        pbuf += sprintf(pbuf, "\n     DOP mask = %.2f", dop_mask);
        pbuf += sprintf(pbuf, "\n     DOP switch = %.2f", dop_switch);