On Thu, Oct 20, 2016 at 11:21:26AM +0200, Otto Moerbeek wrote:
> On Thu, Oct 20, 2016 at 11:17:25AM +0200, Otto Moerbeek wrote:
>
> > On Thu, Oct 20, 2016 at 04:42:13AM -0400, Ted Unangst wrote:
> >
> > > Otto Moerbeek wrote:
> > > > That is certainly not correct: snprintf and friends return the length as
> > > > it would have been if an infinite buffer was passed in.
> > > > So the strlen should stay. I'll make a new diff soon though with the
> > > > error checking, although it might be overkill for this case.
> > >
> > > I think we're getting a little weird here. The circumstances under which
> > > snprintf can return -1 are quite limited.
> >
> > it can only happen on encoding errors, right? These are not relevant
> > in this case.
> >
> > -0tto
>
> But what happens if somebody creates an invalid encoded UTF8 __progname?
>
> -Otto
It seems that as long as we use %s and not %ls we're safe.
-Otto