From f9a906e786fbca1b0bdfe7d3842610ca87035958 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 22 Aug 2005 15:13:39 +0000 Subject: * stdlib/bits/stdlib.h (mbstowcs): Divide __bos (__dst) by sizeof (wchar_t) rather than multiplying __len by sizeof (wchar_t). Pass __bos (__dst) / sizeof (wchar_t) to the *_chk routine. * wcsmbs/bits/wchar2.h (mbsrtowcs, mbsnrtowcs): Likewise. * debug/mbsnrtowcs_chk.c (__mbsnrtowcs_chk): Don't multiply len by sizeof (wchar_t). * debug/mbsrtowcs_chk.c (__mbsrtowcs_chk): Likewise. * debug/mbstowcs_chk.c (__mbstowcs_chk): Likewise. Fix type of SRC argument. Pass &SRC rather than SRC to __mbsrtowcs. * debug/wcstombs_chk.c (__wcstombs_chk): Pass &SRC rather than SRC to __wcsrtombs. * debug/tst-chk1.c: Include assert.h. (do_test): Change enough array from VLA into a fixed size array. Assert that MB_CUR_MAX is <= sizeof (enough). Use FAIL () macro instead of print error details. Add several new tests. Kill some unused variable warnings. --- debug/mbsnrtowcs_chk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debug/mbsnrtowcs_chk.c') diff --git a/debug/mbsnrtowcs_chk.c b/debug/mbsnrtowcs_chk.c index 2041eac87f..8872540ee0 100644 --- a/debug/mbsnrtowcs_chk.c +++ b/debug/mbsnrtowcs_chk.c @@ -24,7 +24,7 @@ size_t __mbsnrtowcs_chk (wchar_t *dst, __const char **src, size_t nmc, size_t len, mbstate_t *ps, size_t dstlen) { - if (__builtin_expect (dstlen < len * sizeof (wchar_t), 0)) + if (__builtin_expect (dstlen < len, 0)) __chk_fail (); return __mbsnrtowcs (dst, src, nmc, len, ps); -- cgit v1.2.1