From 4053ea8d8b7096f2c7b7c7fa309ef14fa764a850 Mon Sep 17 00:00:00 2001 From: Karl Ramm Date: Sun, 22 Aug 2010 00:56:18 +0000 Subject: 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.) --- lib/Zinternal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/Zinternal.c') 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; -- cgit v1.2.3