From: Takao Abe
Date: Fri, 1 May 2015 13:27:32 +0000 (+0000)
Subject: driver40-ja.html:
X-Git-Tag: NTP_4_3_26~2^2^2
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04dab5903139648c82094cf2e2edf677d0c76522;p=thirdparty%2Fntp.git
driver40-ja.html:
[BUG 2806] Correcting typo of the driver40-ja.html
ChangeLog:
[BUG 2806] CID 1296235: refclock_jjy.c and correcting typo of driver40-ja.html
refclock_jjy.c:
[BUG 2806] CID 1296235: Fix refclock_jjy.c and some changes to avoid claims by the check tool
bk: 55437f44kA4RjsB78F6emJHatpyTAw
---
diff --git a/ChangeLog b/ChangeLog
index 7756b9155..0a1890a13 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
---
+* CID 1296235: Fix refclock_jjy.c and correcting type of the driver40-ja.html
* CID 1269537: Clean up a line of dead code in getShmTime().
* CID 1295478: Quiet a pedantic potential error from the fix for Bug 2776.
* [Bug 2590] autogen-5.18.5.
diff --git a/html/drivers/driver40-ja.html b/html/drivers/driver40-ja.html
index 5f4f8939a..45c656d1f 100644
--- a/html/drivers/driver40-ja.html
+++ b/html/drivers/driver40-ja.html
@@ -15,7 +15,7 @@
JJY Receivers
Last update:
- 30-Apr-2015 05:53
+ 11-Apr-2015 00:00
UTC ENGLISHï¼è±èªï¼ JAPANESEï¼æ¥æ¬èªï¼
Synopsis
@@ -306,7 +306,7 @@
Time1 ã¯ãåä¿¡æ©ããã®æå»ã«å ç®ããèª¿æ´æéããåºå®å°æ°ç¹å½¢å¼ã®ç§ã§è¨å®ãã¾ãã
mode 100 ã®å ´åã¯ãtime1 ã§èª¿æ´ããæéãè¨å®ããã»ããè¯ãã§ãããã
- mode 101 ãã 108 ã®å ´åã¯ããã®ãã©ã¤ãã¼ãè¨æ¸¬ããã«ã¼ãããã¯ã®é
å»¶æéã®ä¸å®ã®å²åãåææå»ã«å ç®ãã¾ãã®ã§ãtime1 ã¯è¨å®ããªãã»ããè¯ãã§ãããã
+ mode 101 ãã 180 ã®å ´åã¯ããã®ãã©ã¤ãã¼ãè¨æ¸¬ããã«ã¼ãããã¯ã®é
å»¶æéã®ä¸å®ã®å²åãåææå»ã«å ç®ãã¾ãã®ã§ãtime1 ã¯è¨å®ããªãã»ããè¯ãã§ãããã
Flag1 ã¯ãã¿ããã»ãã¼ã³ããã¤ã¤ã«ã»ãã«ã¹ããæå®ãã¾ãã
| 0 (Default) | ã¿ããã»ãã¼ã³ | ATDWTnn...nn |
diff --git a/ntpd/refclock_jjy.c b/ntpd/refclock_jjy.c
index 420f8bb8c..c10bf64b1 100644
--- a/ntpd/refclock_jjy.c
+++ b/ntpd/refclock_jjy.c
@@ -587,7 +587,10 @@ jjy_receive ( struct recvbuf *rbufp )
*/
if ( up->linediscipline == LDISC_RAW ) {
- pp->lencode = refclock_gtraw ( rbufp, pp->a_lastcode, BMAX, &tRecvTimestamp ) ;
+ pp->lencode = refclock_gtraw ( rbufp, pp->a_lastcode, BMAX-1, &tRecvTimestamp ) ;
+ /* 3rd argument can be BMAX, but the coverity scan tool claim "Memory - corruptions (OVERRUN)" */
+ /* "a_lastcode" is defined as "char a_lastcode[BMAX]" in the ntp_refclock.h */
+ /* To avoid its claim, pass the value BMAX-1. */
/*
* Append received charaters to temporary buffer
@@ -2461,7 +2464,7 @@ jjy_start_telephone ( int unit, struct peer *peer, struct jjyunit *up )
iNumberOfDigitsOfPhoneNumber = iCommaCount = iCommaPosition = iFirstThreeDigitsCount = 0 ;
for ( i = 0 ; i < strlen( sys_phone[0] ) ; i ++ ) {
if ( isdigit( *(sys_phone[0]+i) ) ) {
- if ( iFirstThreeDigitsCount < MAX_LOOPBACK ) {
+ if ( iFirstThreeDigitsCount < sizeof(sFirstThreeDigits)-1 ) {
sFirstThreeDigits[iFirstThreeDigitsCount++] = *(sys_phone[0]+i) ;
}
iNumberOfDigitsOfPhoneNumber ++ ;
@@ -2836,6 +2839,13 @@ teljjy_getDelay ( struct peer *peer, struct jjyunit *up )
iAverCount ++ ;
}
+ if ( iAverCount == 0 ) {
+ /* This is never happened. */
+ /* Previous for-if-for blocks assure iAverCount > 0. */
+ /* This code avoids a claim by the coverity scan tool. */
+ return -1 ;
+ }
+
/* mode 101 = 1%, mode 150 = 50%, mode 180 = 80% */
iPercent = ( peer->ttl - 100 ) ;