From 2d8d8175f1188b355dad77080e07ebc202d8cf37 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 27 Aug 2008 18:31:04 +0000 Subject: [PATCH] 2008-08-27 Corinna Vinschen * libc/stdlib/wcsrtombs.c (_wcsrtombs_r): Fix condition for accepting a converted character and continuing the loop. --- newlib/ChangeLog | 5 +++++ newlib/libc/stdlib/wcsrtombs.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index a3ed9413a..1761a4733 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2008-08-27 Corinna Vinschen + + * libc/stdlib/wcsrtombs.c (_wcsrtombs_r): Fix condition for + accepting a converted character and continuing the loop. + 2008-07-24 Jeff Johnston * libc/include/ctype.h (_ctype_): Restore for C++ backward diff --git a/newlib/libc/stdlib/wcsrtombs.c b/newlib/libc/stdlib/wcsrtombs.c index 6871d0c00..3c1dc4626 100644 --- a/newlib/libc/stdlib/wcsrtombs.c +++ b/newlib/libc/stdlib/wcsrtombs.c @@ -45,7 +45,7 @@ _DEFUN (_wcsrtombs_r, (r, dst, src, len, ps), ps->__count = 0; return (size_t)-1; } - if (n <= len - bytes && bytes < len) + if (n <= len - bytes && bytes <= len) { n += bytes; if (dst)