From 81f221ec74dea760c7fc6faf794da41bdbe09811 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <simon@josefsson.org>
Date: Wed, 1 Jan 2020 12:38:52 +0100
Subject: [PATCH 28/60] telnet: Telnet -E(no escape) is treating
 _POSIX_VDISABLE char as escape.

Reported by Mikhail Bychek <mikhail.bychek@sputnix.ru>.

See also:
https://github.com/freebsd/freebsd/commit/c3694d985891efb8a156e933600d23132577a053
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=6317
---
 ChangeLog       | 6 ++++++
 telnet/telnet.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index b5ced667..b877de19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-01  Simon Josefsson  <simon@josefsson.org>
+
+	* telnet/telnet.c (telsnd): Telnet -E(no escape) is treating
+	_POSIX_VDISABLE char as escape.
+	Reported by Mikhail Bychek <mikhail.bychek@sputnix.ru>.
+
 2018-11-09  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* configure.ac (AC_PREREQ): Require autoconf 2.63.  Gnulib needs
diff --git a/telnet/telnet.c b/telnet/telnet.c
index 55992d79..97be8add 100644
--- a/telnet/telnet.c
+++ b/telnet/telnet.c
@@ -2223,7 +2223,7 @@ telsnd (void)
 	  if ((sc == '\n') || (sc == '\r'))
 	    bol = 1;
 	}
-      else if (sc == escape)
+      else if (escape != _POSIX_VDISABLE && sc == escape)
 	{
 	  /*
 	   * Double escape is a pass through of a single escape character.
-- 
2.26.0.292.g33ef6b2f38

