net-analyzer/nmap: Patch live ebuild
authorJeroen Roovers <jer@gentoo.org>
Thu, 26 Dec 2019 13:09:45 +0000 (14:09 +0100)
committerJeroen Roovers <jer@gentoo.org>
Thu, 26 Dec 2019 13:09:58 +0000 (14:09 +0100)
Package-Manager: Portage-2.3.83, Repoman-2.3.20
Signed-off-by: Jeroen Roovers <jer@gentoo.org>
net-analyzer/nmap/files/nmap-9999-constify-continued.patch [new file with mode: 0644]
net-analyzer/nmap/files/nmap-9999-netutil-else.patch [new file with mode: 0644]
net-analyzer/nmap/nmap-9999.ebuild

diff --git a/net-analyzer/nmap/files/nmap-9999-constify-continued.patch b/net-analyzer/nmap/files/nmap-9999-constify-continued.patch
new file mode 100644 (file)
index 0000000..04738f4
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/libnetutil/EthernetHeader.cc
++++ b/libnetutil/EthernetHeader.cc
+@@ -284,7 +284,7 @@ int EthernetHeader::setEtherType(u16 val){
+ /** Returns destination port in HOST byte order */
+-u16 EthernetHeader::getEtherType() const {
++const u16 EthernetHeader::getEtherType() const {
+   return ntohs(this->h.eth_type);
+ } /* End of getEtherType() */
+--- a/scan_engine.cc
++++ b/scan_engine.cc
+@@ -166,7 +166,7 @@ extern "C" int g_has_npcap_loopback;
+ #endif
+-int HssPredicate::operator() (const HostScanStats *lhs, const HostScanStats *rhs) const {
++const int HssPredicate::operator() (const HostScanStats *lhs, const HostScanStats *rhs) const {
+   const struct sockaddr_storage *lss, *rss;
+   lss = (lhs) ? lhs->target->TargetSockAddr() : ss;
+   rss = (rhs) ? rhs->target->TargetSockAddr() : ss;
diff --git a/net-analyzer/nmap/files/nmap-9999-netutil-else.patch b/net-analyzer/nmap/files/nmap-9999-netutil-else.patch
new file mode 100644 (file)
index 0000000..a96a04b
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/libnetutil/netutil.cc
++++ b/libnetutil/netutil.cc
+@@ -2571,7 +2571,7 @@ const char *ippackethdrinfo(const u8 *packet, u32 len, int detail) {
+     /* CASE 4: where we (finally!) have a full 20 byte TCP header so we can
+      * safely print all fields */
+-    else { /* if (datalen >= 20) */
++    else if (datalen >= 20) {
+       /* TCP Flags */
+       p = tflags;
+@@ -2633,7 +2633,7 @@ const char *ippackethdrinfo(const u8 *packet, u32 len, int detail) {
+           (tcpoptinfo[0]!='\0') ? " " : "",
+           tcpoptinfo, ipinfo);
+       }
+-    } else{
++    } else {
+       /* If the packet does not fall into any other category, then we have a
+          really screwed-up packet. */
+       /* This ought to be unreachable; if static analysis flags it as such, delete it. */
index 4c5cd498f4945df5d95716ef6debcc495e8175fe..c45c2c6b4ce35057e2c6f67d7634312cf83fc291 100644 (file)
@@ -66,6 +66,8 @@ PATCHES=(
        "${FILESDIR}"/${PN}-7.25-libpcre.patch
        "${FILESDIR}"/${PN}-7.31-libnl.patch
        "${FILESDIR}"/${PN}-7.80-ac-config-subdirs.patch
+       "${FILESDIR}"/${PN}-9999-constify-continued.patch
+       "${FILESDIR}"/${PN}-9999-netutil-else.patch
 )
 S="${WORKDIR}/${MY_P}"