summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-08-26 18:39:19 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-08-26 18:39:19 +0000
commit58115bd71f6053545a40a6e880af4cdfade55458 (patch)
tree679249015a7b66f0dfd5e75f9e9aad6789376ce5 /sys
parent6df7b4baa77a61a4750e92d5e84a1e09ea70b0c4 (diff)
Fix for DoS caused by incorrect error handling. From Dmitry V. Levin.
ok miller@ henning@
Diffstat (limited to 'sys')
-rw-r--r--sys/lib/libz/infback.c3
-rw-r--r--sys/lib/libz/inflate.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/sys/lib/libz/infback.c b/sys/lib/libz/infback.c
index 9496e675c7e..52c42db6c60 100644
--- a/sys/lib/libz/infback.c
+++ b/sys/lib/libz/infback.c
@@ -446,6 +446,9 @@ void FAR *out_desc;
}
}
+ if (state->mode == BAD)
+ break;
+
/* build code tables */
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
diff --git a/sys/lib/libz/inflate.c b/sys/lib/libz/inflate.c
index 9ad0ef0baad..ee178ff7db3 100644
--- a/sys/lib/libz/inflate.c
+++ b/sys/lib/libz/inflate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inflate.c,v 1.10 2004/03/24 17:05:48 miod Exp $ */
+/* $OpenBSD: inflate.c,v 1.11 2004/08/26 18:39:18 otto Exp $ */
/* inflate.c -- zlib decompression
* Copyright (C) 1995-2003 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -913,6 +913,9 @@ int flush;
}
}
+ if (state->mode == BAD)
+ break;
+
/* build code tables */
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);