Module Name: src Committed By: christos Date: Thu Jan 16 20:28:51 UTC 2014
Modified Files: src/lib/libc/citrus/modules: citrus_euc.c Log Message: PR/47602: Christos Zoulas: getwc() modifies input instead of returning EILSEQ. Waited for almost a year for feedback and there was none. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/lib/libc/citrus/modules/citrus_euc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/citrus/modules/citrus_euc.c diff -u src/lib/libc/citrus/modules/citrus_euc.c:1.15 src/lib/libc/citrus/modules/citrus_euc.c:1.16 --- src/lib/libc/citrus/modules/citrus_euc.c:1.15 Tue May 28 12:57:56 2013 +++ src/lib/libc/citrus/modules/citrus_euc.c Thu Jan 16 15:28:51 2014 @@ -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 @@ _citrus_EUC_mbrtowc_priv(_EUCEncodingInf 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)