summaryrefslogtreecommitdiff
path: root/ntpd/ntp_leapsec.c
diff options
context:
space:
mode:
Diffstat (limited to 'ntpd/ntp_leapsec.c')
-rw-r--r--ntpd/ntp_leapsec.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/ntpd/ntp_leapsec.c b/ntpd/ntp_leapsec.c
index 14b8cd9..eeef89f 100644
--- a/ntpd/ntp_leapsec.c
+++ b/ntpd/ntp_leapsec.c
@@ -787,7 +787,7 @@ leapsec_add(
const vint64 * now64 ,
int insert)
{
- vint64 ttime, stime;
+ vint64 ttime, starttime;
struct calendar fts;
leap_info_t li;
@@ -815,12 +815,12 @@ leapsec_add(
fts.hour = 0;
fts.minute = 0;
fts.second = 0;
- stime = ntpcal_date_to_ntp64(&fts);
+ starttime = ntpcal_date_to_ntp64(&fts);
fts.month++;
ttime = ntpcal_date_to_ntp64(&fts);
li.ttime = ttime;
- li.stime = ttime.D_s.lo - stime.D_s.lo;
+ li.stime = ttime.D_s.lo - starttime.D_s.lo;
li.taiof = (pt->head.size ? pt->info[0].taiof : pt->head.base_tai)
+ (insert ? 1 : -1);
li.dynls = 1;
@@ -839,7 +839,7 @@ leapsec_raw(
int taiof,
int dynls)
{
- vint64 stime;
+ vint64 starttime;
struct calendar fts;
leap_info_t li;
@@ -856,9 +856,9 @@ leapsec_raw(
return FALSE;
}
fts.month--; /* was in range 1..12, no overflow here! */
- stime = ntpcal_date_to_ntp64(&fts);
+ starttime = ntpcal_date_to_ntp64(&fts);
li.ttime = *ttime;
- li.stime = ttime->D_s.lo - stime.D_s.lo;
+ li.stime = ttime->D_s.lo - starttime.D_s.lo;
li.taiof = (int16_t)taiof;
li.dynls = (dynls != 0);
return add_range(pt, &li);
@@ -920,7 +920,8 @@ do_leap_hash(
/* now do the byte twiddle */
for (wi=0; wi < 5; ++wi)
for (di=3; di >= 0; --di) {
- mac->hv[wi*4 + di] = (unsigned char)tmp[wi];
+ mac->hv[wi*4 + di] =
+ (unsigned char)(tmp[wi] & 0x0FF);
tmp[wi] >>= 8;
}
return TRUE;
@@ -972,7 +973,7 @@ leapsec_validate(
do_hash_data(&mdctx, line+2);
else if (!strncmp(line, "#$", 2))
do_hash_data(&mdctx, line+2);
- else if (isdigit(line[0]))
+ else if (isdigit((unsigned char)line[0]))
do_hash_data(&mdctx, line);
}
isc_sha1_final(&mdctx, ldig.hv);