[or-cvs] Backport: handle truncated compressed data correctly (by de...

Nick Mathewson nickm at seul.org
Thu Oct 13 23:00:07 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv645/src/or

Modified Files:
      Tag: tor-0_1_0-patches
	test.c 
Log Message:
Backport: handle truncated compressed data correctly (by detecting it and giving an error.

Index: test.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/test.c,v
retrieving revision 1.178.2.1
retrieving revision 1.178.2.2
diff -u -d -r1.178.2.1 -r1.178.2.2
--- test.c	7 Jun 2005 18:03:33 -0000	1.178.2.1
+++ test.c	13 Oct 2005 23:00:05 -0000	1.178.2.2
@@ -916,8 +916,12 @@
   test_assert(buf3);
   test_streq(buf1,buf3);
 
-  tor_free(buf2);
+  /* Try truncated compressed data. */
   tor_free(buf3);
+  test_assert(tor_gzip_uncompress(&buf3, &len2, buf2, len1/2, ZLIB_METHOD));
+  test_assert(!buf3);
+
+  tor_free(buf2);
   tor_free(buf1);
 }
 



More information about the tor-commits mailing list