Skip to content

Commit

Permalink
2005-04-26 Ulrich Drepper <drepper@redhat.com>
Browse files Browse the repository at this point in the history
	[BZ #1110]
	* stdio-common/vfscanf.c: Correctly account for characters of
	decimal points right after +-.
2005-04-24  Ulrich Drepper  <drepper@redhat.com>

	[BZ #1110]
	* stdio-common/vfscanf.c: Fix parsing of decimal point after +-.
	Patch by Hamed Malek <hamed@bamdad.org>.
  • Loading branch information
Roland McGrath committed Jul 18, 2005
1 parent 47919fd commit f8d7840
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions stdio-common/vfscanf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,8 @@ _IO_vfscanf (s, format, argptr, errp)
if (c == EOF)
input_error ();

got_dot = got_e = 0;

/* Check for a sign. */
if (c == L_('-') || c == L_('+'))
{
Expand Down Expand Up @@ -1629,14 +1631,13 @@ _IO_vfscanf (s, format, argptr, errp)
const char *cmpp = decimal;
int avail = width > 0 ? width : INT_MAX;

while ((unsigned char) *cmpp == c && avail > 0)
while ((unsigned char) *cmpp == c && avail-- > 0)
if (*++cmpp == '\0')
break;
else
{
if (inchar () == EOF)
break;
--avail;
}

if (*cmpp != '\0')
Expand All @@ -1652,6 +1653,17 @@ _IO_vfscanf (s, format, argptr, errp)

conv_error ();
}
else
{
/* Add all the characters. */
for (cmpp = decimal; *cmpp != '\0'; ++cmpp)
ADDW ((unsigned char) *cmpp);
if (width > 0)
width = avail;
got_dot = 1;

c = inchar ();
}
if (width > 0)
width = avail;
#endif
Expand Down Expand Up @@ -1759,7 +1771,6 @@ _IO_vfscanf (s, format, argptr, errp)
}
}

got_dot = got_e = 0;
do
{
if (ISDIGIT (c))
Expand Down

0 comments on commit f8d7840

Please sign in to comment.