about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-22 18:29:46 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-22 18:29:46 +0000
commitbed381426f198a1cd35cc78795ba2705d10f9580 (patch)
tree0339c9361096ccfcc136cf4b028ccb5d8a5599e3
parent30c8be92a3462155fd8b2cd56eb6afec4df20cdc (diff)
downloadglibc-bed381426f198a1cd35cc78795ba2705d10f9580.tar.gz
glibc-bed381426f198a1cd35cc78795ba2705d10f9580.tar.xz
glibc-bed381426f198a1cd35cc78795ba2705d10f9580.zip
Update.
	* stdio-common/vfscanf.c: Fix handling of %l[].
	Reported by Mitsuru Chinen <mchinen@yamato.ibm.com>.
-rw-r--r--ChangeLog3
-rw-r--r--stdio-common/vfscanf.c7
2 files changed, 6 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 93383773df..e3e0b22791 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2001-08-22  Ulrich Drepper  <drepper@redhat.com>
 
+	* stdio-common/vfscanf.c: Fix handling of %l[].
+	Reported by Mitsuru Chinen <mchinen@yamato.ibm.com>.
+
 	* elf/dl-addr.c (_dl_addr): Fix tests to determine dli_sname.
 	* malloc/mtrace.c (tr_where): dli_sname always points to a
 	non-empty string if != NULL.
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 3c5bccbdc6..4dc9cfe3a2 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -2090,19 +2090,18 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
 		      size_t n;
 
 		      /* Convert it into a wide character.  */
-		      n = __mbrtowc (wstr, buf, cnt, &cstate);
+		      buf[0] = c;
+		      n = __mbrtowc (wstr, buf, 1, &cstate);
 
 		      if (n == (size_t) -2)
 			{
 			  /* Possibly correct character, just not enough
 			     input.  */
+			  ++cnt;
 			  assert (cnt < MB_CUR_MAX);
 			  continue;
 			}
 
-		      if (n != cnt)
-			encode_error ();
-
 		      ++wstr;
 		      if ((flags & MALLOC)
 			  && wstr == (wchar_t *) *strptr + strsize)