openbsd-compat regression tests

Damien Miller djm at mindrot.org
Wed Apr 28 14:34:46 EST 2010


On Mon, 26 Apr 2010, Peter Stuge wrote:

> Hi Jeff,
> 
> FELLIN, JEFF (ATTSI) wrote:
> > The snprintftest.c regression test in openbsd-compat/regress has a
> > buffer overflow error, and an argument error in the calls to snprintf(),
> > and vsnprintf().
> 
> Thanks for the bug report. Did you already fix these issues? Could
> you send a patch against the current source code?

No, as Jeff has no doubt already realised, snprintf should return the
size of the string that it would have created had the supplied buffer
been large enough. This allows the caller to reliably check for
truncation by comparing the return value to the supplied length
(one still needs to check for a -1 return, which can happen
in some obscure cases).

-d


More information about the openssh-unix-dev mailing list