summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libedit/el.h3
-rw-r--r--lib/libedit/eln.c20
-rw-r--r--lib/libedit/read.c14
3 files changed, 21 insertions, 16 deletions
diff --git a/lib/libedit/el.h b/lib/libedit/el.h
index a1e001f0dcb..3dd5eb38276 100644
--- a/lib/libedit/el.h
+++ b/lib/libedit/el.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: el.h,v 1.12 2016/01/30 00:06:39 schwarze Exp $ */
+/* $OpenBSD: el.h,v 1.13 2016/03/20 19:33:16 schwarze Exp $ */
/* $NetBSD: el.h,v 1.21 2009/12/31 15:58:26 christos Exp $ */
/*-
@@ -59,7 +59,6 @@
#define EDIT_DISABLED 0x04
#define UNBUFFERED 0x08
#define CHARSET_IS_UTF8 0x10
-#define IGNORE_EXTCHARS 0x20 /* Ignore characters read > 0xff */
#define NARROW_HISTORY 0x40
#define NARROW_READ 0x80
diff --git a/lib/libedit/eln.c b/lib/libedit/eln.c
index 39bfa6dd48c..3395b239720 100644
--- a/lib/libedit/eln.c
+++ b/lib/libedit/eln.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eln.c,v 1.7 2016/03/20 19:14:29 schwarze Exp $ */
+/* $OpenBSD: eln.c,v 1.8 2016/03/20 19:33:16 schwarze Exp $ */
/* $NetBSD: eln.c,v 1.9 2010/11/04 13:53:12 christos Exp $ */
/*-
@@ -77,10 +77,24 @@ public const char *
el_gets(EditLine *el, int *nread)
{
const wchar_t *tmp;
+ wchar_t *rd, *wr;
- el->el_flags |= IGNORE_EXTCHARS;
tmp = el_wgets(el, nread);
- el->el_flags &= ~IGNORE_EXTCHARS;
+
+ /*
+ * Temporary until the libedit audit is complete:
+ * Filter out all non-ASCII characters.
+ */
+ wr = (wchar_t *)tmp;
+ for (rd = wr; *rd != L'\0'; rd++) {
+ if (wr < rd)
+ *wr = *rd;
+ if (*rd < 128)
+ wr++;
+ }
+ *wr = L'\0';
+ *nread = wr - tmp;
+
return ct_encode_string(tmp, &el->el_lgcyconv);
}
diff --git a/lib/libedit/read.c b/lib/libedit/read.c
index b65233186a3..5093ea33b4e 100644
--- a/lib/libedit/read.c
+++ b/lib/libedit/read.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read.c,v 1.22 2016/03/20 18:20:10 schwarze Exp $ */
+/* $OpenBSD: read.c,v 1.23 2016/03/20 19:33:16 schwarze Exp $ */
/* $NetBSD: read.c,v 1.57 2010/07/21 18:18:52 christos Exp $ */
/*-
@@ -298,7 +298,6 @@ read_char(EditLine *el, Char *cp)
int tried = 0;
char cbuf[MB_LEN_MAX];
int cbp = 0;
- int bytes = 0;
int save_errno = errno;
again:
@@ -334,12 +333,11 @@ read_char(EditLine *el, Char *cp)
#ifdef WIDECHAR
do {
mbstate_t mbs;
- size_t rbytes;
again_lastbyte:
++cbp;
/* This only works because UTF8 is stateless */
memset(&mbs, 0, sizeof(mbs));
- switch (rbytes = ct_mbrtowc(cp, cbuf, cbp, &mbs)) {
+ switch (ct_mbrtowc(cp, cbuf, cbp, &mbs)) {
case (size_t)-1:
if (cbp > 1) {
/*
@@ -370,7 +368,6 @@ again_lastbyte:
goto again;
default:
/* Valid character, process it. */
- bytes = (int)rbytes;
break;
}
} while (/*CONSTCOND*/0);
@@ -378,12 +375,7 @@ again_lastbyte:
*cp = (unsigned char)cbuf[0];
#endif
- if ((el->el_flags & IGNORE_EXTCHARS) && bytes > 1) {
- cbp = 0; /* skip this character */
- goto again;
- }
-
- return (int)num_read;
+ return 1;
}
/* read_pop():