msan: bfd_mach_o_layout_commands use of uninitialised value
authorAlan Modra <amodra@gmail.com>
Sat, 6 Aug 2022 07:35:44 +0000 (17:05 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 6 Aug 2022 09:13:24 +0000 (18:43 +0930)
commitf7a559d5e11c5c023554b48b661aabbcc2c87cb8
tree8a686db06b8a0c9b1faaf59b3cfae7f2e8cab89b
parent578a7392c33c7c7cde5559278e519c75047318c9
msan: bfd_mach_o_layout_commands use of uninitialised value

Catches fuzzed input with unterminated strings that later run off the
end of their buffers when calling strlen.

* mach-o.c: Use size_t vars where approprite.
(bfd_mach_o_alloc_and_read): Add "extra" param.  Allocate that
much extra and clear.  Update all callers, those that set up
strings with one extra byte.
bfd/mach-o.c