--- /dev/null
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+MY_P="${PN}-dnh${PV}"
+
+DESCRIPTION="Enhanced CTorrent is a BitTorrent console client written in C and C++"
+HOMEPAGE="http://www.rahul.net/dholmes/ctorrent/"
+SRC_URI="mirror://sourceforge/dtorrent/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="libressl"
+
+S="${WORKDIR}/${MY_P}"
+
+RDEPEND="
+ libressl? ( dev-libs/libressl:0= )
+ !libressl? ( dev-libs/openssl:0= )
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-CVE-2009-1759.patch
+ "${FILESDIR}"/${P}-negative-ints.patch
+ "${FILESDIR}"/${P}-empty-path-components.patch
+)
Index: bencode.h
===================================================================
---- bencode.h (revision 300)
-+++ bencode.h (revision 302)
+--- a/bencode.h (revision 300)
++++ b/bencode.h (revision 302)
@@ -25,7 +25,7 @@
size_t decode_list(const char *b,size_t len,const char *keylist);
size_t decode_rev(const char *b,size_t len,const char *keylist);
size_t bencode_int(const uint64_t integer, FILE *fp);
Index: bencode.cpp
===================================================================
---- bencode.cpp (revision 300)
-+++ bencode.cpp (revision 302)
+--- a/bencode.cpp (revision 300)
++++ b/bencode.cpp (revision 302)
@@ -233,22 +233,28 @@
return bencode_end_dict_list(fp);
}
return (pb - b + 1);
Index: btfiles.cpp
===================================================================
---- btfiles.cpp (revision 300)
-+++ btfiles.cpp (revision 302)
+--- a/btfiles.cpp (revision 300)
++++ b/btfiles.cpp (revision 302)
@@ -449,7 +449,8 @@
return 0;
}
Index: btcontent.cpp
===================================================================
---- btcontent.cpp (revision 300)
-+++ btcontent.cpp (revision 302)
+--- a/btcontent.cpp (revision 300)
++++ b/btcontent.cpp (revision 302)
@@ -357,7 +357,11 @@
cfg_req_queue_length = (m_piece_length / cfg_req_slice_size) * 2 - 1;
b = (char *)0;
Index: btfiles.h
===================================================================
---- btfiles.h (revision 300)
-+++ btfiles.h (revision 302)
+--- a/btfiles.h (revision 300)
++++ b/btfiles.h (revision 302)
@@ -61,7 +61,7 @@
int BuildFromFS(const char *pathname);