diff --git a/amtu-1.0.4-cleanup.patch b/amtu-1.0.4-cleanup.patch new file mode 100644 index 0000000..cf7a059 --- /dev/null +++ b/amtu-1.0.4-cleanup.patch @@ -0,0 +1,76 @@ +diff -urp amtu-1.0.4.orig/src/iodisktest.c amtu-1.0.4/src/iodisktest.c +--- amtu-1.0.4.orig/src/iodisktest.c 2007-01-09 15:41:48.000000000 -0500 ++++ amtu-1.0.4/src/iodisktest.c 2007-01-09 16:32:38.000000000 -0500 +@@ -74,6 +74,7 @@ + #define MAXLINE 500 + #define MAXINDEX 100 + #define MAXMEMSIZE 10485670 ++#define BDEVNAME_SIZE 32 + + // Structure to track info about partitions + typedef struct { +@@ -279,7 +280,7 @@ int iodisktest(int argc, char *argv[]) + FILE *fname; + FILE *fs; + FILE *fs1; +- char token[10]; ++ char token[BDEVNAME_SIZE]; + char line[MAXLINE]; + int num = 32; + int num_of_rands = 0; +diff -urp amtu-1.0.4.orig/src/networkio.c amtu-1.0.4/src/networkio.c +--- amtu-1.0.4.orig/src/networkio.c 2007-01-09 15:41:48.000000000 -0500 ++++ amtu-1.0.4/src/networkio.c 2007-01-09 17:26:28.000000000 -0500 +@@ -208,6 +208,10 @@ int get_interfaces() + + ifr = ifc.ifc_req; + numifs = ifc.ifc_len/sizeof (struct ifreq); ++ if (numifs > MAX_INTERFACES) { ++ printf("Too many interfaces, only testing the first %d\n", MAX_INTERFACES); ++ numifs = MAX_INTERFACES; ++ } + if (debug) + printf("SIOCGIFCONF has %d interfaces in list:\n", numifs); + +@@ -231,6 +235,7 @@ int get_interfaces() + memset(&ifr_sub, '\0', sizeof(struct ifreq)); + strncpy(ifr_sub.ifr_name, ifr->ifr_name, + sizeof(ifr_sub.ifr_name)); ++ ifr_sub.ifr_name[sizeof(ifr_sub.ifr_name)-1] = 0; + if (ioctl(sock, SIOCGIFFLAGS, (char *)&ifr_sub) < 0) { + fprintf(stderr, "SIOCGIFFLAGS failed for %s.\n", + ifr->ifr_name); +@@ -287,7 +292,7 @@ int get_interfaces() + } + + np->ifindex = ifr_sub.ifr_ifindex; +- np->ifname = (char *)malloc(sizeof(ifr->ifr_name)); ++ np->ifname = strdup(ifr->ifr_name); + if (np->ifname == NULL) + { + fprintf(stderr, "get_interfaces: malloc failed\n"); +@@ -302,8 +307,6 @@ int get_interfaces() + return -1; + } + +- strncpy(np->ifname, ifr->ifr_name, sizeof(ifr->ifr_name)); +- + if (ioctl(sock, SIOCGIFHWADDR, &ifr_sub) < 0) { + fprintf(stderr, "SIOCGIFHWADDR failed for %s.\n", + ifr_sub.ifr_name); +@@ -403,7 +406,6 @@ int networkio(int argc, char *argv[]) + */ + bzero(packetbuf, sizeof(packetbuf)); + bzero(&from, sizeof(from)); +- len = sizeof(from); + rsock_fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_LOOP)); + + memset(&rcv_info, 0, sizeof(rcv_info)); +@@ -449,6 +451,7 @@ int networkio(int argc, char *argv[]) + */ + count = 0; + do { ++ len = sizeof(from); + cc = recvfrom(rsock_fd, packetbuf, sizeof(packetbuf), + MSG_DONTWAIT, (struct sockaddr *)&from, &len); + diff --git a/amtu.spec b/amtu.spec index ebca196..3b7d37d 100644 --- a/amtu.spec +++ b/amtu.spec @@ -1,10 +1,11 @@ Summary: Abstract Machine Test Utility (AMTU) Name: amtu Version: 1.0.4 -Release: 3.1 +Release: 4%{?dist} License: Common Public License Group: System Environment/Base Source0: %{name}-%{version}.tar.gz +Patch1: amtu-1.0.4-cleanup.patch BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: audit-libs-devel >= 1.1.2 BuildRequires: automake @@ -21,6 +22,7 @@ http://www.radium.ncsc.mil/tpep/library/protection_profiles/CAPP-1.d.pdf %prep %setup +%patch1 -p1 %build # Determine appropriate compiler @@ -61,6 +63,9 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_mandir}/man8/* %changelog +* Tue Jan 9 2007 Steve Grubb 1.0.4-4 +- patch fixing network and disk tests + * Wed Jul 12 2006 Jesse Keating - 1.0.4-3.1 - rebuild