Web lists-archives.com

Re: [MPlayer-dev-eng] [PATCH 2/2] subreader: Check the %n result variable.

On Mon, May 26, 2014 at 11:06:18AM +0200, Nicolas George wrote:
> Le quintidi 5 prairial, an CCXXII, Reimar Döffinger a écrit :
> > This ensures we had an actual match against the
> > full string.
> Sorry to have pointed the obvious in my previous mail. The change looks
> completely valid.
> > Ideally this would be possible by checking for a one larger
> > return value, but unfortunately the standard is unclear if
> > %n arguments should be counted or not...
> Actually, the standard is perfectly clear... with the wrong choice:
> "Execution of a %n conversion specification shall not increment the
> assignment count returned at the completion of execution of the function."

Yes, man sscanf quotes that as well but then continues:
..."but the Corrigendum seems to contradict this.  Probably it is wise not
to make any assumptions"...
And I believe this issue that some implementations count is a real one,
I remember the issue coming up, which is why it is >= instead of ==
for all scanfs that use %n.
MPlayer-dev-eng mailing list