From 56e36ef7b55ed3ad5bf2a5bb72f91a9c5498ee6e Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Mon, 1 Aug 2005 18:56:46 +0000
Subject: [PATCH] in get_word_kbinput(), limit the input word to hexadecimal
 FFFD instead of FFFF, as FFFE and FFFF are invalid Unicode characters

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2967 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog   | 3 +++
 src/winio.c | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5b620124..8ea1d695 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -260,6 +260,9 @@ CVS code -
 	  the number of lines and characters in the file or selection,
 	  as wc does. (DLR)
 - winio.c:
+  get_word_kbinput()
+	- Limit the input word to hexadecimal FFFD instead of FFFF, as
+	  FFFE and FFFF are invalid Unicode characters. (DLR)
   display_string()
 	- Instead of using parse_mbchar()'s bad_chr parameter, use
 	  mbrep() to get the representation of a bad character. (DLR)
diff --git a/src/winio.c b/src/winio.c
index e77a9f4f..c7a17e10 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1232,7 +1232,7 @@ int get_byte_kbinput(int kbinput
 }
 
 /* Translate a word sequence: turn a four-digit hexadecimal number from
- * 0000 to ffff (case-insensitive) into its corresponding word value. */
+ * 0000 to fffd (case-insensitive) into its corresponding word value. */
 int get_word_kbinput(int kbinput
 #ifndef NANO_SMALL
 	, bool reset
@@ -1303,7 +1303,7 @@ int get_word_kbinput(int kbinput
 		word += (kbinput - '0');
 		retval = word;
 	    } else if ('a' <= tolower(kbinput) &&
-		tolower(kbinput) <= 'f') {
+		tolower(kbinput) <= 'd') {
 		word += (tolower(kbinput) + 10 - 'a');
 		retval = word;
 	    } else
-- 
GitLab