[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Backport: handle truncated compressed data correctly (by de...
Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv645/src/common
Modified Files:
Tag: tor-0_1_0-patches
torgzip.c
Log Message:
Backport: handle truncated compressed data correctly (by detecting it and giving an error.
Index: torgzip.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/torgzip.c,v
retrieving revision 1.16.2.1
retrieving revision 1.16.2.2
diff -u -d -r1.16.2.1 -r1.16.2.2
--- torgzip.c 13 Jul 2005 05:30:38 -0000 1.16.2.1
+++ torgzip.c 13 Oct 2005 23:00:05 -0000 1.16.2.2
@@ -192,6 +192,10 @@
if (stream->avail_out >= stream->avail_in+16)
break;
case Z_BUF_ERROR:
+ if (stream->avail_out > 0) {
+ log_fn(LOG_WARN, "possible truncated or corrupt zlib data");
+ goto err;
+ }
offset = stream->next_out - ((unsigned char*)*out);
out_size *= 2;
*out = tor_realloc(*out, out_size);