From b256f8f2f822f0c5667839addeb026af0b037c18 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Tue, 10 Sep 2002 12:04:29 +0000 Subject: Fix buffer overruns. --- lib/Zinternal.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/Zinternal.c') diff --git a/lib/Zinternal.c b/lib/Zinternal.c index 9fb9a3f..1a3fcec 100644 --- a/lib/Zinternal.c +++ b/lib/Zinternal.c @@ -471,6 +471,11 @@ Code_t Z_AddNoticeToEntry(qptr, notice, part) struct _Z_Hole *hole, *lasthole; struct timeval tv; + /* Bounds check. */ + if (part < 0 || notice->z_message_len < 0 || part > qptr->msg_len + || notice->z_message_len > qptr->msg_len - part) + return (ZERR_NONE); + /* Incorporate this notice's checked authentication. */ if (notice->z_checked_auth == ZAUTH_FAILED) qptr->auth = ZAUTH_FAILED; -- cgit v1.2.3