🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #262338

Re: [Tin] Cannot paste a Message-Id to search

#262338
From: Urs Janßen
Date: Sat, 21 Oct 2017 11:50
34 lines
1809 bytes
In <os20p9$kru$1@herbert.ortolo.eu>, Tanguy Ortolo wrote:
> Have you already seen such an issue?

the following patch fixes the issue

=== modified file 'src/tcurses.c'
@@ -583,13 +583,16 @@
 
 		if (wch < KEY_MIN) {
 			/* read in the multibyte sequence */
-			char *mbs = my_malloc(MB_CUR_MAX + 1);
+			char *mbs = my_calloc(1, MB_CUR_MAX + 1);
 			int i, ch;
 			wchar_t wc;
 
 			mbs[0] = (char) wch;
 			nodelay(stdscr, TRUE);
-			for (i = 1; i < (int) MB_CUR_MAX; i++) {
+			res = mbtowc(&wc, mbs, MB_CUR_MAX);
+			for (i = 1; i < (int) MB_CUR_MAX && res == -1; i++) {
+				if ((res = mbtowc(&wc, mbs, MB_CUR_MAX)) > 0)
+					break;
 				if ((ch = getch()) != ERR)
 					mbs[i] = (char) ch;
 				else
@@ -597,8 +600,6 @@
 			}
 			nodelay(stdscr, FALSE);
 
-			mbs[i] = '\0';
-			res = mbtowc(&wc, mbs, MB_CUR_MAX);
 			free(mbs);
 			if (res == -1)
 				return WEOF; /* error */
Technical Details
Message-ID: <osfcah$8fo$1@nntp.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mail
References: <os20p9$kru$1@herbert.ortolo.eu>

Show Full Headers
Complete Article Headers
Message-ID: <osfcah$8fo$1@nntp.de>
Subject: Re: [Tin] Cannot paste a Message-Id to search
Date: Sat, 21 Oct 2017 11:50:41 +0000
From: Urs Janßen <urs@buil.tin.org>
References: <os20p9$kru$1@herbert.ortolo.eu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mail
Newsgroups: news.software.readers
Organization: tin.org
Lines: 35
Archive: no
X-Trace: nntp.de 1508586641 8696 129.13.251.69 (21 Oct 2017 11:50:41 GMT)
X-Complaints-To: abuse@nntp.de
User-Agent: tin/2.4.2-20171008 ("Daill") (UNIX) (Linux/3.16.0-4-amd64 (x86_64))
Cancel-Lock: sha1:MTazZeAZkrxD80+MkqqKNbKttHk=
X-No-Archive: yes
X-No-HTML: yes
X-Received-Body-CRC: 2959028922
X-Received-Bytes: 1748