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] Clear .idata$6 before use


Hi,

The memory allocated for .idata$6 in dlltool isn't cleared before use, which
can result in random data remaining after the import names. (I noticed this
when working on making DLLs build reproducibly.)

The following patch just memsets the allocated memory.

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


diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index e83052a..6d8d0f8 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -2783,6 +2783,7 @@ make_one_lib_file (export_type *exp, int i, int delay)
              else
                si->size = strlen (xlate (exp->import_name)) + 3;
              si->data = xmalloc (si->size);
+             memset (si->data, 0, si->size);
              si->data[0] = idx & 0xff;
              si->data[1] = idx >> 8;
              if (exp->its_name)

Attachment: pgpyy9Kh4G_1T.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]