This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH dlltool] Avoid segfaulting if output_def can't be opened for writing


Hi,

As reported in https://bugs.debian.org/519788, dlltool segfaults if the
output-def file can't be opened for writing. The following patch checks
the result of the corresponding fopen. (It may fuzz by one line depending
on whether my previous patch is applied or not.)

Signed-off-by: Stephen Kitt <steve@sk2.org>



diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index e83052a..2a6295c 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -4151,6 +4152,11 @@ main (int ac, char **av)
          break;
        case 'z':
          output_def = fopen (optarg, FOPEN_WT);
+
+         if (!output_def)
+           /* xgettext:c-format */
+           fatal (_("Unable to open def-file: %s"), optarg);
+
          break;
        case 'D':
          dll_name = (char*) lbasename (optarg);

Attachment: pgpRB4hvLz3mf.pgp
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]