From 468dcfe9e91eedb8620c0c25252b551484f37112 Mon Sep 17 00:00:00 2001 From: Arun S A G Date: Sep 10 2018 16:01:13 +0000 Subject: Fix build failure with gcc8 --- diff --git a/ArpON-gcc-8-fixes.patch b/ArpON-gcc-8-fixes.patch new file mode 100644 index 0000000..a83ac4b --- /dev/null +++ b/ArpON-gcc-8-fixes.patch @@ -0,0 +1,131 @@ +From 22301de7ea5c313eb5ec283ef615e36928ce584b Mon Sep 17 00:00:00 2001 +From: Arun S A G +Date: Mon, 10 Sep 2018 08:37:41 -0700 +Subject: [PATCH] ArpON gcc 8 fixes + +--- + src/arpca.c | 3 ++- + src/darpi.c | 12 ++++++++---- + src/harpi.c | 12 ++++++++---- + src/sarpi.c | 8 ++++++-- + src/sig.c | 2 +- + 5 files changed, 25 insertions(+), 12 deletions(-) + +diff --git a/src/arpca.c b/src/arpca.c +index 0160c7e..fe1afab 100644 +--- a/src/arpca.c ++++ b/src/arpca.c +@@ -436,7 +436,8 @@ arpca_add(const struct arp_entry *entry) + interface = opt_getinterface(); + + /* Copy the interface in the ARP request structure. */ +- strncpy(ar.arp_dev, interface, IF_NAMESIZE); ++ strncpy(ar.arp_dev, interface, IF_NAMESIZE -1); ++ ar.arp_dev[IF_NAMESIZE -1] = '\0'; + + /* + * Overwrite the IP entry in the ARP cache +diff --git a/src/darpi.c b/src/darpi.c +index f4ad134..b3a901c 100644 +--- a/src/darpi.c ++++ b/src/darpi.c +@@ -66,17 +66,21 @@ darpi_handler(int op, struct ether_addr *macsrc, struct in_addr *ipsrc, + interface = opt_getinterface(); + + /* MAC src addr network byte order to string. */ +- strncpy(smacsrc, ether_ntoa(macsrc), INTF_ETHERSTRLEN); ++ strncpy(smacsrc, ether_ntoa(macsrc), INTF_ETHERSTRLEN-1); ++ smacsrc[INTF_ETHERSTRLEN-1] = '\0'; + + /* IP src addr network byte order to string. */ +- strncpy(sipsrc, inet_ntoa(*ipsrc), INET_ADDRSTRLEN); ++ strncpy(sipsrc, inet_ntoa(*ipsrc), INET_ADDRSTRLEN-1); ++ sipsrc[INET_ADDRSTRLEN-1] = '\0'; + + #ifndef NDEBUG + /* MAC dst addr network byte order to string. */ +- strncpy(smacdst, ether_ntoa(macdst), INTF_ETHERSTRLEN); ++ strncpy(smacdst, ether_ntoa(macdst), INTF_ETHERSTRLEN-1); ++ smacdst[INTF_ETHERSTRLEN-1] = '\0'; + + /* IP dst addr network byte order to string. */ +- strncpy(sipdst, inet_ntoa(*ipdst), INET_ADDRSTRLEN); ++ strncpy(sipdst, inet_ntoa(*ipdst), INET_ADDRSTRLEN-1); ++ sipdst[INET_ADDRSTRLEN-1] = '\0'; + #endif /* !NDEBUG */ + + /* Check the type of the ARP packet read. */ +diff --git a/src/harpi.c b/src/harpi.c +index d981715..66b1139 100644 +--- a/src/harpi.c ++++ b/src/harpi.c +@@ -68,17 +68,21 @@ harpi_handler(int op, struct ether_addr *macsrc, struct in_addr *ipsrc, + interface = opt_getinterface(); + + /* MAC src addr network byte order to string. */ +- strncpy(smacsrc, ether_ntoa(macsrc), INTF_ETHERSTRLEN); ++ strncpy(smacsrc, ether_ntoa(macsrc), INTF_ETHERSTRLEN-1); ++ smacsrc[INTF_ETHERSTRLEN-1] = '\0'; + + /* IP src addr network byte order to string. */ +- strncpy(sipsrc, inet_ntoa(*ipsrc), INET_ADDRSTRLEN); ++ strncpy(sipsrc, inet_ntoa(*ipsrc), INET_ADDRSTRLEN-1); ++ sipsrc[INET_ADDRSTRLEN-1] = '\0'; + + #ifndef NDEBUG + /* MAC dst addr network byte order to string. */ +- strncpy(smacdst, ether_ntoa(macdst), INTF_ETHERSTRLEN); ++ strncpy(smacdst, ether_ntoa(macdst), INTF_ETHERSTRLEN-1); ++ smacdst[INTF_ETHERSTRLEN-1] = '\0'; + + /* IP dst addr network byte order to string. */ +- strncpy(sipdst, inet_ntoa(*ipdst), INET_ADDRSTRLEN); ++ strncpy(sipdst, inet_ntoa(*ipdst), INET_ADDRSTRLEN-1); ++ sipdst[INET_ADDRSTRLEN-1] = '\0'; + #endif /* !NDEBUG */ + + /* Check the type of the ARP packet read. */ +diff --git a/src/sarpi.c b/src/sarpi.c +index b90104b..8961255 100644 +--- a/src/sarpi.c ++++ b/src/sarpi.c +@@ -67,17 +67,21 @@ sarpi_handler(int op, struct ether_addr *macsrc, struct in_addr *ipsrc, + interface = opt_getinterface(); + + /* MAC src addr network byte order to string. */ +- strncpy(smacsrc, ether_ntoa(macsrc), INTF_ETHERSTRLEN); ++ strncpy(smacsrc, ether_ntoa(macsrc), INTF_ETHERSTRLEN-1); ++ smacsrc[INTF_ETHERSTRLEN-1] = '\0'; + + /* IP src addr network byte order to string. */ +- strncpy(sipsrc, inet_ntoa(*ipsrc), INET_ADDRSTRLEN); ++ strncpy(sipsrc, inet_ntoa(*ipsrc), INET_ADDRSTRLEN-1); ++ sipsrc[INET_ADDRSTRLEN-1] = '\0'; + + #ifndef NDEBUG + /* MAC dst addr network byte order to string. */ + strncpy(smacdst, ether_ntoa(macdst), INTF_ETHERSTRLEN); ++ smacdst[INTF_ETHERSTRLEN-1] = '\0'; + + /* IP dst addr network byte order to string. */ + strncpy(sipdst, inet_ntoa(*ipdst), INET_ADDRSTRLEN); ++ sipdst[INET_ADDRSTRLEN-1] = '\0'; + #endif /* !NDEBUG */ + + /* Check the type of the ARP packet read. */ +diff --git a/src/sig.c b/src/sig.c +index d2a34cd..a07539e 100644 +--- a/src/sig.c ++++ b/src/sig.c +@@ -204,7 +204,7 @@ sig_loop(char **argv, char **envp) + case SIGINT: + /* Remove ^C symbol from the output terminal. */ + printf("\r"); +- /* FALLTHRU */ ++ /* Fallthrough. */ + + case SIGTERM: + MSG_DEBUG("Caught %s (%d)..", SIG_ITOA(sig), sig); +-- +2.17.1 + diff --git a/ArpON.spec b/ArpON.spec index 3071982..d7ce046 100644 --- a/ArpON.spec +++ b/ArpON.spec @@ -1,12 +1,13 @@ Name: ArpON Version: 3.0 -Release: 9%{?dist} +Release: 10%{?dist} Summary: ARP handler inspection License: BSD URL: http://arpon.sourceforge.net/ Source0: http://downloads.sourceforge.net/project/arpon/arpon/ArpON-%{version}/ArpON-%{version}-ng.tar.gz -Patch1: ArpON-gcc-7-fixes.patch +Patch1: ArpON-gcc-7-fixes.patch +Patch2: ArpON-gcc-8-fixes.patch BuildRequires: gcc BuildRequires: libpcap-devel @@ -23,23 +24,30 @@ attack. %prep %setup -q -n %{name}-%{version}-ng %patch1 -p1 +%patch2 -p1 %build -%cmake . -%make_build - +%cmake -DCMAKE_INSTALL_PREFIX="/" . +%{__make} %{?_smp_mflags} %install %{__install} -D -pm 755 src/arpon %{buildroot}%{_sbindir}/arpon %{__install} -D -pm 644 man8/arpon.8 %{buildroot}%{_mandir}/man8/arpon.8 +%{__install} -D -pm 644 etc/arpon.conf %{buildroot}/etc/arpon.conf +%{__install} -D -pm 644 log/arpon.log %{buildroot}/var/log/arpon.log %files %license LICENSE %doc AUTHOR CHANGELOG doc/* %{_sbindir}/arpon +/etc/arpon.conf +/var/log/arpon.log %{_mandir}/man8/arpon.8* %changelog +* Tue Sep 04 2018 Arun S A G - 3.0-10 +- Fix GCC 8 compiler warnings are treated as errors + * Thu Jul 12 2018 Fedora Release Engineering - 3.0-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild