From: Harlan Stenn Date: Sat, 25 Sep 2010 21:11:34 +0000 (+0000) Subject: [Bug 1643] from 4.2.6p3: Range-check the decoding of the RIPE-NCC status codes X-Git-Tag: NTP_4_2_7P56~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e365c83d6f0fc070dcc339e5296f5e3d7175e966;p=thirdparty%2Fntp.git [Bug 1643] from 4.2.6p3: Range-check the decoding of the RIPE-NCC status codes bk: 4c9e6586UT_wy9DcYoc_eKt7i08ntg --- diff --git a/ChangeLog b/ChangeLog index 23e1d149f..af74322f7 100644 --- 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 * Documentation updates from Dave Mills. * [Bug 1636] from 4.2.6p3-RC2: segfault after denied remote config. diff --git a/ntpd/refclock_ripencc.c b/ntpd/refclock_ripencc.c index 1cba53dc0..94a1de46d 100644 --- a/ntpd/refclock_ripencc.c +++ b/ntpd/refclock_ripencc.c @@ -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);