Hi Dmitrij,

Dmitrij D. Czarkoff wrote on Mon, Nov 30, 2015 at 11:37:12PM +0100:
> Ingo Schwarze said:

>>  * I am resetting mbtowc(3) internal state after failure,
>>    even though that has no effect on OpenBSD, if only as a
>>    reminder that there be dragons.  It costs almost nothing,
>>    neither in terms of clutter nor in terms of performance.

> This doesn't make sense to me.
> In case of utf8 mbtowc(3) is stateless.

True.

> (We discussed that with stsp@,

True.

> but I am not convinced that we should pay
> any attention to the "internal state".)

As i said, on OpenBSD, it has no effect.

But in case somebody takes our src/bin/ls/, ports it to some other
operating system, and uses it on file names encoded in ISO/IEC
2022-JP that unfortunately contain occasional invalid byte sequences,
it might save their day.

One of the most important points to observe for secure programming
is using interfaces correctly, even if they are awkward.  Therefore,
until we can make up our mind what, if anything, to do about the
awkwardness of the definition of the mbtowc(3) interface, which
would seem premature to me at this point in time, i'm mildly in
favour of including that line.

Then again, i don't feel all that strongly about it.

Opinions?

Yours,
  Ingo


> Otherwise OK czarkoff@.

Thanks for checking!

Reply via email to