rpms/rb_libtorrent/F-7 rb_libtorrent-svn1968-bdecode_recursive-security-fix.patch, NONE, 1.1

Peter Gordon (pgordon) fedora-extras-commits at redhat.com
Tue Jan 29 08:14:04 UTC 2008


Author: pgordon

Update of /cvs/pkgs/rpms/rb_libtorrent/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20824/F-7

Added Files:
	rb_libtorrent-svn1968-bdecode_recursive-security-fix.patch 
Log Message:
Oopsie; add the patch too.

rb_libtorrent-svn1968-bdecode_recursive-security-fix.patch:

--- NEW FILE rb_libtorrent-svn1968-bdecode_recursive-security-fix.patch ---
--- /branches/RC_0_12/include/libtorrent/bencode.hpp (revision 727)
+++ /branches/RC_0_12/include/libtorrent/bencode.hpp (revision 1968)
@@ -201,6 +201,7 @@
 
 		template<class InIt>
-		void bdecode_recursive(InIt& in, InIt end, entry& ret)
-		{
+		void bdecode_recursive(InIt& in, InIt end, entry& ret, int depth)
+		{
+			if (depth >= 100) throw invalid_encoding();
 			if (in == end) throw invalid_encoding();
 			switch (*in)
@@ -229,5 +230,5 @@
 					ret.list().push_back(entry());
 					entry& e = ret.list().back();
-					bdecode_recursive(in, end, e);
+					bdecode_recursive(in, end, e, depth + 1);
 					if (in == end) throw invalid_encoding();
 				}
@@ -245,7 +246,7 @@
 				{
 					entry key;
-					bdecode_recursive(in, end, key);
+					bdecode_recursive(in, end, key, depth + 1);
 					entry& e = ret[key.string()];
-					bdecode_recursive(in, end, e);
+					bdecode_recursive(in, end, e, depth + 1);
 					if (in == end) throw invalid_encoding();
 				}
@@ -286,5 +287,5 @@
 		{
 			entry e;
-			detail::bdecode_recursive(start, end, e);
+			detail::bdecode_recursive(start, end, e, 0);
 			return e;
 		}




More information about the fedora-extras-commits mailing list