about summary refs log tree commit diff
path: root/stdio-common/vfscanf.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/vfscanf.c')
-rw-r--r--stdio-common/vfscanf.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 4f6a531b0c..75e187b765 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -1776,7 +1776,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
 		      ADDW (c);
 		      got_dot = 1;
 		    }
-		  else if (thousands != L'\0' && ! got_dot && c == thousands)
+		  else if ((flags & GROUP) != 0 && thousands != L'\0'
+			   && ! got_dot && c == thousands)
 		    ADDW (c);
 		  else
 		    {
@@ -1820,12 +1821,13 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
 			 we can compare against it.  */
 		      const char *cmp2p = thousands;
 
-		      if (thousands != NULL && ! got_dot)
+		      if ((flags & GROUP) != 0 && thousands != NULL
+			  && ! got_dot)
 			{
-			  while (cmp2p < cmpp
+			  while (cmp2p - thousands < cmpp - decimal
 				 && *cmp2p == decimal[cmp2p - thousands])
 			    ++cmp2p;
-			  if (cmp2p == cmpp)
+			  if (cmp2p - thousands == cmpp - decimal)
 			    {
 			      while ((unsigned char) *cmp2p == c && avail > 0)
 				if (*++cmp2p == '\0')