aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfd.c
diff options
context:
space:
mode:
authorPavel I. Kryukov <kryukov@frtk.ru>2017-10-03 22:42:07 +0300
committerAlan Modra <amodra@gmail.com>2017-10-04 14:24:21 +1030
commit9ba5f27cdd15d22d6c5739ff5d2b1c81d796e114 (patch)
tree6d6c60d6a5362a98335f92579ad1d0fa8f3c3769 /bfd/bfd.c
parentAutomatic date update in version.in (diff)
downloadbinutils-gdb-9ba5f27cdd15d22d6c5739ff5d2b1c81d796e114.tar.gz
binutils-gdb-9ba5f27cdd15d22d6c5739ff5d2b1c81d796e114.tar.bz2
binutils-gdb-9ba5f27cdd15d22d6c5739ff5d2b1c81d796e114.zip
PR22245, Fix potential UB in bfd_set_error
Passing enum as a first argument to variadic argument function may lead to undefined behavior. The explanation on CERT site: https://www.securecoding.cert.org/confluence/display/cplusplus/ EXP58-CPP.+Pass+an+object+of+the+correct+type+to+va_start The bug was found by Kirill Nedostoev (nedostoev.ka@phystech.edu) when he tried to build GNU binutils with Clang 7. PR 22245 * bfd.c (bfd_set_error): Avoid UB on passing arg to va_start that undergoes default promotion. * bfd-in2.h: Regenerate.
Diffstat (limited to 'bfd/bfd.c')
-rw-r--r--bfd/bfd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 665f182559b..5da1a6fd53a 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -497,7 +497,7 @@ FUNCTION
bfd_set_error
SYNOPSIS
- void bfd_set_error (bfd_error_type error_tag, ...);
+ void bfd_set_error (int error_tag, ...);
DESCRIPTION
Set the BFD error condition to be @var{error_tag}.
@@ -507,7 +507,7 @@ DESCRIPTION
*/
void
-bfd_set_error (bfd_error_type error_tag, ...)
+bfd_set_error (int error_tag, ...)
{
bfd_error = error_tag;
if (error_tag == bfd_error_on_input)