summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@1ts.org>2010-08-22 00:56:18 +0000
committerGravatar Karl Ramm <kcr@1ts.org>2010-08-22 00:56:18 +0000
commit4053ea8d8b7096f2c7b7c7fa309ef14fa764a850 (patch)
tree7d778c60f2e961fd09b93bf5bcdaa11b3060cf96 /lib
parent13e92009052efec4f7898565ca3871fd2e54dcee (diff)
Make sure broken packets get timed out from the queue.
(The time used to be set before the bounds check, so one could potentially get an accumulation of packets in the queue without timestamps that could never be assembled into a full notice; thanks to nelhage@mit.edu for noticing.)
Diffstat (limited to 'lib')
-rw-r--r--lib/Zinternal.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Zinternal.c b/lib/Zinternal.c
index e822b5e..6e74219 100644
--- a/lib/Zinternal.c
+++ b/lib/Zinternal.c
@@ -528,6 +528,10 @@ Z_AddNoticeToEntry(struct _Z_InputQ *qptr,
struct _Z_Hole *hole, *lasthole;
struct timeval tv;
+ /* Make sure this notice is expirable */
+ (void) gettimeofday(&tv, (struct timezone *)0);
+ qptr->timep = tv.tv_sec;
+
/* Bounds check. */
if (part < 0 || notice->z_message_len < 0 || part > qptr->msg_len
|| notice->z_message_len > qptr->msg_len - part)
@@ -539,9 +543,6 @@ Z_AddNoticeToEntry(struct _Z_InputQ *qptr,
else if (notice->z_checked_auth == ZAUTH_NO && qptr->auth != ZAUTH_FAILED)
qptr->auth = ZAUTH_NO;
- (void) gettimeofday(&tv, (struct timezone *)0);
- qptr->timep = tv.tv_sec;
-
last = part+notice->z_message_len-1;
hole = qptr->holelist;