stdio.h: enable vs?printf clang FORTIFY_SOURCE

Enable FORTIFY_SOURCE protections under clang for the following
functions:

  * vsprintf
  * vsnprintf

and add unittests.

Change-Id: I90f8a27f7b202c78b5dd8ebf53050bf9e33496f7
This commit is contained in:
Nick Kralevich
2013-06-27 08:58:14 -07:00
parent fbec57d46c
commit c8ae8bd941
5 changed files with 219 additions and 2 deletions

View File

@@ -454,7 +454,6 @@ __END_DECLS
__BEGIN_DECLS
#if !defined(__clang__)
__BIONIC_FORTIFY_INLINE
__printflike(3, 0)
int vsnprintf(char *dest, size_t size, const char *format, __va_list ap)
@@ -468,7 +467,6 @@ int vsprintf(char *dest, const char *format, __va_list ap)
{
return __builtin___vsprintf_chk(dest, 0, __bos(dest), format, ap);
}
#endif /* !defined(__clang__) */
#if defined(__clang__)
#define snprintf(dest, size, ...) __builtin___snprintf_chk(dest, size, 0, __bos(dest), __VA_ARGS__)