glibc/stdio-common
Zack Weinberg 4e2f43f842 Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319)
The _chk variants of all of the printf functions become much simpler.
This is the last thing that we needed _IO_acquire_lock_clear_flags2
for, so it can go as well.  I took the opportunity to make the headers
included and the names of all local variables consistent across all the
affected files.

Since we ultimately want to get rid of __no_long_double as well, it
must be possible to get all of the nontrivial effects of the _chk
functions by calling the _internal functions with appropriate flags.
For most of the __(v)xprintf_chk functions, this is covered by
PRINTF_FORTIFY plus some up-front argument checks that can be
duplicated.  However, __(v)sprintf_chk installs a custom jump table so
that it can crash instead of overflowing the output buffer.  This
functionality is moved to __vsprintf_internal, which now has a
'maxlen' argument like __vsnprintf_internal; to get the unsafe
behavior of ordinary (v)sprintf, pass -1 for that argument.

obstack_printf_chk and obstack_vprintf_chk are no longer in the same
file.

As a side-effect of the unification of both fortified and non-fortified
vdprintf initialization, this patch fixes bug 11319 for __dprintf_chk
and __vdprintf_chk, which was previously fixed only for dprintf and
vdprintf by the commit

commit 7ca890b88e
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Wed Feb 24 16:07:57 2010 -0800

    Fix reporting of I/O errors in *dprintf functions.

This patch adds a test case to avoid regressions.

Tested for powerpc and powerpc64le.
2018-12-05 18:15:43 -02:00
..
bits
Depend
Makefile Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
Versions Add __vfscanf_internal and __vfwscanf_internal with flags arguments. 2018-12-05 18:15:42 -02:00
_i18n_number.h
_itoa.c
_itowa.c
_itowa.h
asprintf.c Add __v*printf_internal with flags arguments 2018-12-05 18:15:42 -02:00
bug-vfprintf-nargs.c
bug1.c
bug1.input
bug2.c
bug3.c
bug4.c
bug5.c
bug6.c
bug6.input
bug7.c Avoid insecure usage of tmpnam in tests. 2018-07-18 21:04:12 +00:00
bug8.c
bug9.c
bug10.c
bug11.c
bug12.c
bug13.c
bug14.c
bug16.c
bug17.c
bug18.c
bug18a.c
bug19.c
bug19a.c
bug20.c
bug21.c
bug22.c Disable -Wformat-overflow= warnings for some printf tests. 2018-11-01 17:13:55 +00:00
bug23-2.c
bug23-3.c
bug23-4.c
bug23.c
bug24.c
bug25.c
bug26.c
ctermid.c
cuserid.c
dprintf.c Add __v*printf_internal with flags arguments 2018-12-05 18:15:42 -02:00
errlist.c
errnobug.c
flockfile.c
fprintf.c Add __v*printf_internal with flags arguments 2018-12-05 18:15:42 -02:00
fscanf.c
ftrylockfile.c
funlockfile.c
fxprintf.c Add __v*printf_internal with flags arguments 2018-12-05 18:15:42 -02:00
gentempfd.c
getline.c
getw.c
iovfscanf.c Add __vfscanf_internal and __vfwscanf_internal with flags arguments. 2018-12-05 18:15:42 -02:00
iovfwscanf.c Add __vfscanf_internal and __vfwscanf_internal with flags arguments. 2018-12-05 18:15:42 -02:00
isoc99_fscanf.c Use SCANF_ISOC99_A instead of _IO_FLAGS2_SCANF_STD. 2018-12-05 18:15:42 -02:00
isoc99_scanf.c Use SCANF_ISOC99_A instead of _IO_FLAGS2_SCANF_STD. 2018-12-05 18:15:42 -02:00
isoc99_sscanf.c Use SCANF_ISOC99_A instead of _IO_FLAGS2_SCANF_STD. 2018-12-05 18:15:42 -02:00
isoc99_vfscanf.c Use SCANF_ISOC99_A instead of _IO_FLAGS2_SCANF_STD. 2018-12-05 18:15:42 -02:00
isoc99_vscanf.c Use SCANF_ISOC99_A instead of _IO_FLAGS2_SCANF_STD. 2018-12-05 18:15:42 -02:00
isoc99_vsscanf.c Use SCANF_ISOC99_A instead of _IO_FLAGS2_SCANF_STD. 2018-12-05 18:15:42 -02:00
itoa-digits.c
itoa-udigits.c
itowa-digits.c
perror.c
printf-parse.h
printf-parsemb.c
printf-parsewc.c
printf-prs.c
printf.c Add __v*printf_internal with flags arguments 2018-12-05 18:15:42 -02:00
printf.h
printf_fp.c
printf_fphex.c
printf_size.c
psiginfo-data.h
psiginfo-define.h
psiginfo.c
psignal.c
putw.c
reg-modifier.c
reg-printf.c
reg-type.c
remove.c
rename.c
renameat.c Add renameat2 function [BZ #17662] 2018-07-05 19:00:10 +02:00
renameat2.c Add renameat2 function [BZ #17662] 2018-07-05 19:00:10 +02:00
scanf.c Add __vfscanf_internal and __vfwscanf_internal with flags arguments. 2018-12-05 18:15:42 -02:00
scanf1.c
scanf2.c
scanf3.c
scanf4.c
scanf5.c
scanf7.c
scanf8.c
scanf9.c
scanf10.c
scanf11.c
scanf12.c
scanf12.input
scanf13.c
scanf14.c
scanf15.c
scanf16.c
scanf17.c
siglist.c
snprintf.c Add __v*printf_internal with flags arguments 2018-12-05 18:15:42 -02:00
sprintf.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
sscanf.c Add __vfscanf_internal and __vfwscanf_internal with flags arguments. 2018-12-05 18:15:42 -02:00
stdio_ext.h
stdio_lim.h.in
tempnam.c
tempname.c
temptest.c
test-fseek.c
test-fwrite.c
test-popen.c
test-vfprintf.c
test_rdwr.c
tfformat.c
tiformat.c
tllformat.c
tmpfile.c
tmpfile64.c
tmpnam.c
tmpnam_r.c
tst-bz11319-fortify2.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
tst-bz11319.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
tst-cookie.c
tst-fdopen.c Avoid insecure usage of tmpnam in tests. 2018-07-18 21:04:12 +00:00
tst-ferror.c
tst-ferror.input
tst-fgets.c
tst-fileno.c
tst-fmemopen.c
tst-fmemopen2.c
tst-fmemopen3.c
tst-fmemopen4.c
tst-fphex-wide.c
tst-fphex.c
tst-fseek.c Don't reduce test timeout to less than default 2018-10-17 09:34:13 +02:00
tst-fwrite.c
tst-gets.c
tst-gets.input
tst-grouping.c
tst-long-dbl-fphex.c
tst-obprintf.c
tst-perror.c
tst-popen.c
tst-popen2.c
tst-printf-bz18872.sh
tst-printf-round.c
tst-printf.c Disable -Wformat-overflow= warnings for some printf tests. 2018-11-01 17:13:55 +00:00
tst-printf.sh stdio-common/tst-printf.c: Remove part under a non-free license [BZ #23363] 2018-07-03 18:29:16 +02:00
tst-printfsz-islongdouble.c ldbl-128ibm-compat: Add printf_size 2018-07-02 10:51:01 -03:00
tst-printfsz-islongdouble.sh ldbl-128ibm-compat: Add printf_size 2018-07-02 10:51:01 -03:00
tst-printfsz.c
tst-put-error.c
tst-renameat2.c Add renameat2 function [BZ #17662] 2018-07-05 19:00:10 +02:00
tst-rndseek.c Don't reduce test timeout to less than default 2018-10-17 09:34:13 +02:00
tst-scanf-round.c
tst-setvbuf1.c
tst-setvbuf1.expect
tst-sprintf.c
tst-sprintf2.c
tst-sprintf3.c
tst-sscanf.c
tst-swprintf.c
tst-swscanf.c
tst-tmpnam.c
tst-unbputc.c
tst-unbputc.sh
tst-ungetc.c Avoid insecure usage of tmpnam in tests. 2018-07-18 21:04:12 +00:00
tst-unlockedio.c
tst-vfprintf-mbs-prec.c
tst-vfprintf-user-type.c
tst-vfprintf-width-prec.c
tst-wc-printf.c
tstdiomisc.c
tstgetln.c
tstgetln.input
tstscanf.c
tstscanf.input
vfprintf-internal.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
vfprintf.c Add __v*printf_internal with flags arguments 2018-12-05 18:15:42 -02:00
vfscanf-internal.c Use SCANF_LDBL_IS_DBL instead of __ldbl_is_dbl. 2018-12-05 18:15:42 -02:00
vfscanf.c Add __vfscanf_internal and __vfwscanf_internal with flags arguments. 2018-12-05 18:15:42 -02:00
vfwprintf-internal.c Add __v*printf_internal with flags arguments 2018-12-05 18:15:42 -02:00
vfwprintf.c Add __v*printf_internal with flags arguments 2018-12-05 18:15:42 -02:00
vfwscanf-internal.c Add __vfscanf_internal and __vfwscanf_internal with flags arguments. 2018-12-05 18:15:42 -02:00
vfwscanf.c Add __vfscanf_internal and __vfwscanf_internal with flags arguments. 2018-12-05 18:15:42 -02:00
vprintf.c Add __v*printf_internal with flags arguments 2018-12-05 18:15:42 -02:00
xbug.c