[nc/f15] Do not send CRLF line endings in an extra packet (#719386)

Petr Sabata psabata at fedoraproject.org
Thu Jul 7 15:24:42 UTC 2011


commit 3651c98ad5f46b35b1d467ce9304c0058ca1b34b
Author: Petr Sabata <contyk at redhat.com>
Date:   Thu Jul 7 17:24:11 2011 +0200

    Do not send CRLF line endings in an extra packet (#719386)

 nc-1.100-crlf.patch |    6 +++---
 nc.spec             |    6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/nc-1.100-crlf.patch b/nc-1.100-crlf.patch
index 9f8a0f8..e92f054 100644
--- a/nc-1.100-crlf.patch
+++ b/nc-1.100-crlf.patch
@@ -34,9 +34,9 @@
 -					if (atomicio(vwrite, nfd, buf, n) != n)
 -						return;
 +					if (Cflag && (buf[n-1] == '\n')) {
-+						if (atomicio(vwrite, nfd, buf, n-1) != (n-1))
-+							return;
-+						if (atomicio(vwrite, nfd, "\r\n", 2) != 2)
++						buf[n-1] = '\r';
++						buf[n]   = '\n';
++						if (atomicio(vwrite, nfd, buf, n+1) != n+1)
 +							return;
 +					} else {
 +						if (atomicio(vwrite, nfd, buf, n) != n)
diff --git a/nc.spec b/nc.spec
index 69412c2..5a296a9 100644
--- a/nc.spec
+++ b/nc.spec
@@ -1,7 +1,7 @@
 Summary:    Reads and writes data across network connections using TCP or UDP
 Name:       nc
 Version:    1.100
-Release:    2%{?dist}
+Release:    3%{?dist}
 URL:        http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/nc/
 License:    BSD ISC
 Group:      Applications/Internet
@@ -59,6 +59,10 @@ install -m 644 nc.1 %{buildroot}%{_mandir}/man1
 %{_mandir}/man1/nc.1*
 
 %changelog
+* Thu Jul 07 2011 Petr Sabata <contyk at redhat.com> - 1.100-3
+- Do not send CRLF line endings in an extra packet
+  Thanks to Jaroslav Franek, rhbz#719386
+
 * Mon Apr 11 2011 Petr Sabata <psabata at redhat.com> - 1.100-2
 - Include libbsd stdlib, rhbz#694407
 - Use %zd format for size_t


More information about the scm-commits mailing list