Date: Fri, 18 Sep 1998 11:20:06 -0700 (PDT) From: Niall Smart <nialls@euristix.ie> To: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/7970: Bug in *scanf: %n is sometimes ignored. Message-ID: <199809181820.LAA00445@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/7970; it has been noted by GNATS.
From: Niall Smart <nialls@euristix.ie>
To: "Jin Guojun (ITG staff)" <jin@george.lbl.gov>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/7970: Bug in *scanf: %n is sometimes ignored.
Date: Fri, 18 Sep 1998 14:23:37 +0100
> > The following code demonstrates the bug:
> >
> > sscanf("24\n", "%li %n", &i, &n);
> >
> > printf("%d %d\n", i, n);
> >
> > return 0;
> > }
> >
> > The output should be "4 2", but it is "4 12345678"; n is not
> > ...
> The output should be "24 3", you have 3 bytes in the stream and the first
> "%li" is 24. If you got "4 2", then it is completely wrong somewhere.
Whoops, a miscreant "2" slipped in there somehow, the format string should
be "4\n".
Niall
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809181820.LAA00445>
