Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)



On Thu, Apr 22, 2021 at 7:01 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> > POSIX requires:
> >
> > | Stéphane|
> > |  Chazelas|
>
> I would think that's intentional, at least for the precision
> (e.g. %.4s) in order to prevent buffer overflow.

That makes sense for C-ish languages, but I would think it was a bad
idea in general for the shell to allocate buffer sizes based on user
input.

Someone can probably point to the rationale document, but I'm guessing
this is really because of equivalence with sprintf() formats.




Messages sorted by: Reverse Date, Date, Thread, Author