64-bit snprintf/vsnprintf overflow condition

Howland Craig D (Craig) howland@LGSInnovations.com
Fri Oct 29 18:45:00 GMT 2010

INT_MAX is the behavior required by POSIX.  See
under the ERRORS section where EOVERFLOW is described.

-----Original Message-----
From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org]
On Behalf Of David A. Ramos
Sent: Friday, October 29, 2010 2:04 PM
To: newlib@sourceware.org
Subject: 64-bit snprintf/vsnprintf overflow condition


It looks like the overflow condition in vsnprintf/snprintf is
unnecessarily restrictive for 64-bit architectures.

from libc/stdio/snprintf.c:
 52  if (size > INT_MAX)
 53    {
 54      ptr->_errno = EOVERFLOW;
 55      return EOF;
 56    }

I believe it should use SIZE_MAX, rather than INT_MAX.


More information about the Newlib mailing list