Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/citrus/modules PR/47602: Christos Zoulas: getwc() m...



details:   https://anonhg.NetBSD.org/src/rev/b086f0482a5a
branches:  trunk
changeset: 792785:b086f0482a5a
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jan 16 20:28:51 2014 +0000

description:
PR/47602: Christos Zoulas: getwc() modifies input instead of returning EILSEQ.
Waited for almost a year for feedback and there was none.

diffstat:

 lib/libc/citrus/modules/citrus_euc.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 3bdf5912cb1f -r b086f0482a5a lib/libc/citrus/modules/citrus_euc.c
--- a/lib/libc/citrus/modules/citrus_euc.c      Thu Jan 16 19:16:42 2014 +0000
+++ b/lib/libc/citrus/modules/citrus_euc.c      Thu Jan 16 20:28:51 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: citrus_euc.c,v 1.15 2013/05/28 16:57:56 joerg Exp $    */
+/*     $NetBSD: citrus_euc.c,v 1.16 2014/01/16 20:28:51 christos Exp $ */
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -60,7 +60,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_euc.c,v 1.15 2013/05/28 16:57:56 joerg Exp $");
+__RCSID("$NetBSD: citrus_euc.c,v 1.16 2014/01/16 20:28:51 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
@@ -273,7 +273,8 @@
        wchar = 0;
        while (len-- > 0)
                wchar = (wchar << 8) | (*s1++ & 0xff);
-       wchar = (wchar & ~ei->mask) | ei->bits[cs];
+       if (wchar != (wchar & ~ei->mask) | ei->bits[cs])
+               goto encoding_error;
 
        psenc->chlen = 0;
        if (pwc)



Home | Main Index | Thread Index | Old Index