[ngrep] Add format security check fix. Add patch for libpcap 1.5. Cleanup and rebase.
Christopher Meng
cicku at fedoraproject.org
Sat Dec 21 08:29:32 UTC 2013
commit 26db18d9890ad9b672119eebef0e0946863e9541
Author: Christopher Meng <i at cicku.me>
Date: Sat Dec 21 16:28:18 2013 +0800
Add format security check fix.
Add patch for libpcap 1.5.
Cleanup and rebase.
ngrep-gcc-format-security-fix.patch | 72 +++++++++++++++++++++++++++++++++++
ngrep.spec | 50 ++++++++++++++----------
2 files changed, 102 insertions(+), 20 deletions(-)
---
diff --git a/ngrep-gcc-format-security-fix.patch b/ngrep-gcc-format-security-fix.patch
new file mode 100644
index 0000000..6eba178
--- /dev/null
+++ b/ngrep-gcc-format-security-fix.patch
@@ -0,0 +1,72 @@
+Index: ngrep-code-16ba99a863a89dab25cbf8e9ca410b19a7494c42/ngrep.c
+===================================================================
+--- ngrep-code-16ba99a863a89dab25cbf8e9ca410b19a7494c42/ngrep.c
++++ ngrep-code-16ba99a863a89dab25cbf8e9ca410b19a7494c42/ngrep.c
+@@ -1005,13 +1005,13 @@ void dump_byline(unsigned char *data, ui
+
+ while (s < data + len) {
+ if (should_hilite && s == hilite_start)
+- printf(ANSI_hilite);
++ printf("%s", ANSI_hilite);
+
+ printf("%c", (*s == '\n' || isprint(*s)) ? *s : nonprint_char);
+ s++;
+
+ if (should_hilite && s == hilite_end)
+- printf(ANSI_off);
++ printf("%s", ANSI_off);
+ }
+
+ printf("\n");
+@@ -1027,13 +1027,13 @@ void dump_unwrapped(unsigned char *data,
+
+ while (s < data + len) {
+ if (should_hilite && s == hilite_start)
+- printf(ANSI_hilite);
++ printf("%s", ANSI_hilite);
+
+ printf("%c", isprint(*s) ? *s : nonprint_char);
+ s++;
+
+ if (should_hilite && s == hilite_end)
+- printf(ANSI_off);
++ printf("%s", ANSI_off);
+ }
+
+ printf("\n");
+@@ -1056,7 +1056,7 @@ void dump_formatted(unsigned char *data,
+ for (j = 0; j < width; j++) {
+ if (should_hilite && (mindex <= (i+j) && (i+j) < mindex + msize)) {
+ hiliting = 1;
+- printf(ANSI_hilite);
++ printf("%s", ANSI_hilite);
+ }
+
+ if (i + j < len)
+@@ -1068,7 +1068,7 @@ void dump_formatted(unsigned char *data,
+
+ if (hiliting) {
+ hiliting = 0;
+- printf(ANSI_off);
++ printf("%s", ANSI_off);
+ }
+ }
+ }
+@@ -1076,7 +1076,7 @@ void dump_formatted(unsigned char *data,
+ for (j = 0; j < width; j++) {
+ if (should_hilite && mindex <= (i+j) && (i+j) < mindex + msize) {
+ hiliting = 1;
+- printf(ANSI_hilite);
++ printf("%s", ANSI_hilite);
+ }
+
+ if (i + j < len)
+@@ -1085,7 +1085,7 @@ void dump_formatted(unsigned char *data,
+
+ if (hiliting) {
+ hiliting = 0;
+- printf(ANSI_off);
++ printf("%s", ANSI_off);
+ }
+ }
+
diff --git a/ngrep.spec b/ngrep.spec
index 7b0c839..a40e758 100644
--- a/ngrep.spec
+++ b/ngrep.spec
@@ -1,20 +1,24 @@
-# Note: building with PCRE instead of GNU regex because of license
-# incompatibilities (this one's basically a BSD with advertising clause).
+%global gitdate 20131221
+%global commit 16ba99a863a89dab25cbf8e9ca410b19a7494c42
+%global gitrev %(c=%{commit}; echo ${c:0:7})
Name: ngrep
Version: 1.45
-Release: 14%{?dist}
+Release: 15.git%{gitdate}.%{gitrev}%{?dist}
Summary: Network layer grep tool
License: BSD with advertising
URL: http://ngrep.sourceforge.net
-Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
-Source1: %{name}-README.fedora
-Patch0: %{name}-system-pcre.patch
-Patch1: ngrep-aarch64.patch
+# Link below is the release link.
+# Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
+# However we need to checkout the latest version from VCS repository
+# SourceForge has offered snapshot download so we just use it.
+Source0: http://sourceforge.net/code-snapshots/git/n/ng/ngrep/code.git/ngrep-code-%{commit}.zip
+Source1: ngrep-README.fedora
+Patch0: ngrep-gcc-format-security-fix.patch
BuildRequires: autoconf
BuildRequires: automake
-BuildRequires: pcre-devel
BuildRequires: libpcap-devel
+BuildRequires: pcre-devel
%description
ngrep strives to provide most of GNU grep's common features, applying them
@@ -26,17 +30,18 @@ interfaces, and understands bpf filter logic in the same fashion as more
common packet sniffing tools, such as tcpdump and snoop.
%prep
-%setup -q
+%setup -qn ngrep-code-%{commit}
%patch0 -p1
-%patch1 -p1
-install -pm 644 %{S:1} ./README.fedora
+install -pm644 %{S:1} ./README.fedora
%build
-export EXTRA_INCLUDES=$(pcre-config --cflags)
-export EXTRA_LIBS=$(pcre-config --libs)
autoreconf -fiv
-%configure --enable-pcre --enable-ipv6 --with-pcap-includes=%{_includedir}/pcap
-make %{?_smp_mflags} STRIPFLAG=
+# Note: building with PCRE instead of GNU regex because of license
+# incompatibilities (this one's basically a BSD with advertising clause).
+%configure --with-regex=pcre --with-regex-impl=sys \
+ --enable-ipv6 \
+ --with-pcap-includes=%{_includedir}/pcap
+make %{?_smp_mflags} CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" STRIPFLAG=
%install
make install DESTDIR=%{buildroot} BINDIR_INSTALL=%{_sbindir}
@@ -47,6 +52,11 @@ make install DESTDIR=%{buildroot} BINDIR_INSTALL=%{_sbindir}
%{_mandir}/man8/ngrep.8*
%changelog
+* Sat Dec 21 2013 Christopher Meng <rpm at cicku.me> - 1.45-15
+- Checkout from official repo(BZ#1044630).
+- Remove patch for system pcre as configure script can handle it now.
+- Add format security check fix due to dumb GCC.
+
* Mon Aug 26 2013 Christopher Meng <rpm at cicku.me> - 1.45-14
- SPEC Cleanup.
- AArch64 support(BZ#926232).
@@ -98,19 +108,19 @@ make install DESTDIR=%{buildroot} BINDIR_INSTALL=%{_sbindir}
* Tue Sep 19 2006 Patrick "Jima" Laughton <jima at beer.tclug.org> - 1.44-6
- Bump for FC6 rebuild
-* Fri Sep 08 2006 Oliver Falk <oliver at linux-kernel.at> - 1.44-5
+* Fri Sep 08 2006 Oliver Falk <oliver at linux-kernel.at> - 1.44-5
- Fix BR
-* Tue Oct 18 2005 Oliver Falk <oliver at linux-kernel.at> - 1.44-4
+* Tue Oct 18 2005 Oliver Falk <oliver at linux-kernel.at> - 1.44-4
- Bug #170967, useless debuginfo was generated
-* Wed Aug 24 2005 Oliver Falk <oliver at linux-kernel.at> - 1.44-3
+* Wed Aug 24 2005 Oliver Falk <oliver at linux-kernel.at> - 1.44-3
- Bugs from #166481
-* Mon Aug 22 2005 Oliver Falk <oliver at linux-kernel.at> - 1.44-2
+* Mon Aug 22 2005 Oliver Falk <oliver at linux-kernel.at> - 1.44-2
- Bug #165963
- Merge with package from Ville
See also https://www.redhat.com/archives/fedora-extras-list/2005-July/msg01009.html
-* Thu Aug 11 2005 Oliver Falk <oliver at linux-kernel.at> - 1.44-1
+* Thu Aug 11 2005 Oliver Falk <oliver at linux-kernel.at> - 1.44-1
- Initial build for Fedora Extras
More information about the scm-commits
mailing list