Subject: lib/4838: scanf(3) doesn't skip whitespace properly
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ian.dall@dsto.defence.gov.au>
List: netbsd-bugs
Date: 01/18/1998 23:58:57
>Number: 4838
>Category: lib
>Synopsis: scanf(3) doesn't skip whitespace properly
>Confidential: yes
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people (Library Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jan 18 05:35:01 1998
>Last-Modified:
>Originator: Ian Dall
>Organization:
>Release: 1.3
>Environment:
System: NetBSD sibyl.chez-dall.org.au 1.3_BETA NetBSD 1.3_BETA (SIBYL) #0: Sat Dec 20 01:17:57 CST 1997 ian@sibyl.chez-dall.org.au:/usr3/netbsd-1.2/lsrc/sys/arch/pc532/compile/SIBYL pc532
>Description:
According to scanf(3), blank space in a scan pattern means skip any
amount of white space *including zero*. With the pattern "%d %n" the
white space does not match zero white space.
>How-To-Repeat:
The folowing program prints 999 characters processed instead of 3.
int main(void)
{
int ret, i, n=999;
ret = sscanf("123","%d %n", &i, &n);
printf("%d conversions = %d, %d chars processed\n", ret, i, n);
}
>Fix:
>Audit-Trail:
>Unformatted: