buffer overrun: backport fix from NTP project (Coverity NetBSD Scan 8: CID 1509)
This commit is contained in:
parent
15dc7197ee
commit
a1cdcab3c8
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: refclock_chu.c,v 1.3 2003/12/04 16:23:37 drochner Exp $ */
|
||||
/* $NetBSD: refclock_chu.c,v 1.4 2006/03/21 11:12:13 kardel Exp $ */
|
||||
|
||||
/*
|
||||
* refclock_chu - clock driver for Canadian CHU time/frequency station
|
||||
|
@ -1114,7 +1114,7 @@ chu_b(
|
|||
up->tstamp[up->ntstamp] = up->cstamp[i];
|
||||
L_SUB(&up->tstamp[up->ntstamp], &offset);
|
||||
L_ADD(&offset, &up->charstamp);
|
||||
if (up->ntstamp < MAXSTAGE)
|
||||
if (up->ntstamp < MAXSTAGE - 1)
|
||||
up->ntstamp++;
|
||||
}
|
||||
}
|
||||
|
@ -1218,7 +1218,7 @@ chu_a(
|
|||
up->tstamp[up->ntstamp] = up->cstamp[i];
|
||||
L_SUB(&up->tstamp[up->ntstamp], &offset);
|
||||
L_ADD(&offset, &up->charstamp);
|
||||
if (up->ntstamp < MAXSTAGE)
|
||||
if (up->ntstamp < MAXSTAGE - 1)
|
||||
up->ntstamp++;
|
||||
}
|
||||
while (temp > up->prevsec) {
|
||||
|
|
Loading…
Reference in New Issue