Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen Handle invalid character sequences.
details: https://anonhg.NetBSD.org/src/rev/2a898bc1f3bf
branches: trunk
changeset: 784895:2a898bc1f3bf
user: christos <christos%NetBSD.org@localhost>
date: Wed Feb 13 15:22:09 2013 +0000
description:
Handle invalid character sequences.
diffstat:
lib/libc/gen/vis.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (31 lines):
diff -r f71f2c323e0d -r 2a898bc1f3bf lib/libc/gen/vis.c
--- a/lib/libc/gen/vis.c Wed Feb 13 14:03:48 2013 +0000
+++ b/lib/libc/gen/vis.c Wed Feb 13 15:22:09 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vis.c,v 1.48 2013/02/13 12:15:09 pooka Exp $ */
+/* $NetBSD: vis.c,v 1.49 2013/02/13 15:22:09 christos Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.48 2013/02/13 12:15:09 pooka Exp $");
+__RCSID("$NetBSD: vis.c,v 1.49 2013/02/13 15:22:09 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#ifdef __FBSDID
__FBSDID("$FreeBSD$");
@@ -315,8 +315,10 @@
mbslength = mblength;
while (mbslength) {
clen = mbtowc(src, mbsrc, mbslength);
- if (clen < 0)
- break;
+ if (clen < 0) {
+ *src = (wint_t)(u_char)*mbsrc;
+ clen = 1;
+ }
if (clen == 0)
clen = 1;
src++;
Home |
Main Index |
Thread Index |
Old Index