summaryrefslogtreecommitdiff
path: root/debug/vwprintf_chk.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug/vwprintf_chk.c')
-rw-r--r--debug/vwprintf_chk.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/debug/vwprintf_chk.c b/debug/vwprintf_chk.c
index 51b67c159d..c95bf13e6c 100644
--- a/debug/vwprintf_chk.c
+++ b/debug/vwprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,29 +13,18 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-#include "../libio/libioP.h"
+#include <libio/libioP.h>
/* Write formatted output to stdout from the format string FORMAT. */
int
__vwprintf_chk (int flag, const wchar_t *format, va_list ap)
{
- int done;
+ /* For flag > 0 (i.e. __USE_FORTIFY_LEVEL > 1) request that %n
+ can only come from read-only format strings. */
+ unsigned int mode = (flag > 0) ? PRINTF_FORTIFY : 0;
- _IO_acquire_lock_clear_flags2 (stdout);
- if (flag > 0)
- stdout->_flags2 |= _IO_FLAGS2_FORTIFY;
-
- done = _IO_vfwprintf (stdout, format, ap);
-
- if (flag > 0)
- stdout->_flags2 &= ~_IO_FLAGS2_FORTIFY;
- _IO_release_lock (stdout);
-
- return done;
+ return __vfwprintf_internal (stdout, format, ap, mode);
}