110882Speter/* Checking vsnprintf.
210882Speter   Copyright (C) 2005 Free Software Foundation, Inc.
312661Speter
412661SpeterThis file is part of GCC.
512661Speter
612661SpeterGCC is free software; you can redistribute it and/or modify it under
712661Speterthe terms of the GNU General Public License as published by the Free
812661SpeterSoftware Foundation; either version 2, or (at your option) any later
912661Speterversion.
1012661Speter
1112661SpeterIn addition to the permissions in the GNU General Public License, the
1212661SpeterFree Software Foundation gives you unlimited permission to link the
1312661Spetercompiled version of this file into combinations with other programs,
1412661Speterand to distribute those combinations without any restriction coming
1512661Speterfrom the use of this file.  (The General Public License restrictions
1612661Speterdo apply in other respects; for example, they cover modification of
1712661Speterthe file, and distribution when not linked into a combine
1812661Speterexecutable.)
1912661Speter
2012661SpeterGCC is distributed in the hope that it will be useful, but WITHOUT ANY
2112661SpeterWARRANTY; without even the implied warranty of MERCHANTABILITY or
2212661SpeterFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2312661Speterfor more details.
2412661Speter
2510882SpeterYou should have received a copy of the GNU General Public License
2610882Speteralong with GCC; see the file COPYING.  If not, write to the Free
2710882SpeterSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
2812661Speter02110-1301, USA.  */
2912661Speter
30107902Skuriyama/* As a special exception, if you link this library with files compiled with
3112661Speter   GCC to produce an executable, this does not cause the resulting executable
32155346Sceri   to be covered by the GNU General Public License. This exception does not
3310882Speter   however invalidate any other reasons why the executable file might be
3410882Speter   covered by the GNU General Public License.  */
35155346Sceri
3610882Speter#include "config.h"
3710882Speter#include <ssp/ssp.h>
3810882Speter#include <stdarg.h>
3912661Speter#ifdef HAVE_STDIO_H
4012661Speter# include <stdio.h>
4110882Speter#endif
4210882Speter
4310882Speterextern void __chk_fail (void) __attribute__((__noreturn__));
4410882Speter
4510882Speter#ifdef HAVE_USABLE_VSNPRINTF
4610882Speterint
4710882Speter__vsnprintf_chk (char *s, size_t n, int flags __attribute__((unused)),
4810882Speter		 size_t slen, const char *format, va_list arg)
4910882Speter{
5010882Speter  if (n > slen)
5110882Speter    __chk_fail ();
5210882Speter
5310882Speter  return vsnprintf (s, n, format, arg);
5410882Speter}
5510882Speter#endif
5610882Speter