diff options
Diffstat (limited to 'contrib/ntp/ntpd/refclock_jjy.c')
-rw-r--r-- | contrib/ntp/ntpd/refclock_jjy.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/contrib/ntp/ntpd/refclock_jjy.c b/contrib/ntp/ntpd/refclock_jjy.c index f53150f..22636a0 100644 --- a/contrib/ntp/ntpd/refclock_jjy.c +++ b/contrib/ntp/ntpd/refclock_jjy.c @@ -592,7 +592,7 @@ jjy_receive ( struct recvbuf *rbufp ) l_fp tRecvTimestamp; /* arrival timestamp */ int rc ; char *pBuf, sLogText [ MAX_LOGTEXT ] ; - int iLen, iCopyLen ; + size_t iLen, iCopyLen ; int i, j, iReadRawBuf, iBreakPosition ; /* @@ -744,8 +744,8 @@ jjy_receive ( struct recvbuf *rbufp ) } iCopyLen = ( iLen <= sizeof(sLogText)-1 ? iLen : sizeof(sLogText)-1 ) ; - strncpy( sLogText, pBuf, iCopyLen ) ; - sLogText[iCopyLen] = 0 ; + memcpy( sLogText, pBuf, iCopyLen ) ; + sLogText[iCopyLen] = '\0' ; jjy_write_clockstats( peer, JJY_CLOCKSTATS_MARK_RECEIVE, sLogText ) ; switch ( up->unittype ) { @@ -2688,8 +2688,9 @@ jjy_start_telephone ( int unit, struct peer *peer, struct jjyunit *up ) { char sLog [ 80 ], sFirstThreeDigits [ 4 ] ; - int i, iNumberOfDigitsOfPhoneNumber, iCommaCount, iCommaPosition ; - int iFirstThreeDigitsCount ; + int iNumberOfDigitsOfPhoneNumber, iCommaCount, iCommaPosition ; + size_t i ; + size_t iFirstThreeDigitsCount ; jjy_write_clockstats( peer, JJY_CLOCKSTATS_MARK_JJY, "Refclock: Telephone JJY" ) ; @@ -3823,7 +3824,7 @@ modem_receive ( struct recvbuf *rbufp ) struct jjyunit *up; struct refclockproc *pp; char *pBuf ; - int iLen ; + size_t iLen ; #ifdef DEBUG static const char *sFunctionName = "modem_receive" ; @@ -3857,11 +3858,11 @@ modem_receive ( struct recvbuf *rbufp ) #ifdef DEBUG if ( debug ) { char sResp [ 40 ] ; - int iCopyLen ; + size_t iCopyLen ; iCopyLen = ( iLen <= sizeof(sResp)-1 ? iLen : sizeof(sResp)-1 ) ; strncpy( sResp, pBuf, iLen <= sizeof(sResp)-1 ? iLen : sizeof(sResp)-1 ) ; sResp[iCopyLen] = 0 ; - printf ( "refclock_jjy.c : modem_receive : iLen=%d pBuf=[%s] iModemEvent=%d\n", iCopyLen, sResp, up->iModemEvent ) ; + printf ( "refclock_jjy.c : modem_receive : iLen=%zu pBuf=[%s] iModemEvent=%d\n", iCopyLen, sResp, up->iModemEvent ) ; } #endif modem_control ( peer, pp, up ) ; |