[PATCH dlltool] Clear .idata$6 before use

Stephen Kitt steve@sk2.org
Thu May 28 19:04:00 GMT 2015


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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20150528/e88d63a3/attachment.sig>


More information about the Binutils mailing list