[issue2588] PyOS_vsnprintf() underflow leads to memory corruption

Alexander Belopolsky report at bugs.python.org
Wed Apr 9 03:37:22 CEST 2008


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Tue, Apr 8, 2008 at 9:21 PM, Justin Ferguson <report at bugs.python.org> wrote:

> ..
>  While no one seems to ever use it this way, don't forget that a good
>  alternative to asprintf() is calling sprintf() with a length of zero to
>  get the length (in compliant implementations), allocating the memory and
>  then calling it again.

Remember that PyOS_vsnprintf was introduced back in 2001 when
(according to the comments in the file) not all platforms provided c99
compliant implementations.  If you can verify that the situation has
changes for the supported platforms, I think you will have a good case
for making the wrapper c99 compliant.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2588>
__________________________________


More information about the Python-bugs-list mailing list