elftoolchain nm(1): Initialize allocated memory before use
authorcem <cem@FreeBSD.org>
Fri, 16 Mar 2018 22:25:33 +0000 (22:25 +0000)
committercem <cem@FreeBSD.org>
Fri, 16 Mar 2018 22:25:33 +0000 (22:25 +0000)
commitc033b5978ec7662ff39840a19092334755c381df
treeb803e4201b5a88fcce302269a2626cc14acaaf0c
parent108df59632116ec2b7ff660fac989cd953cc3173
elftoolchain nm(1): Initialize allocated memory before use

In out of memory scenarios (where one of these allocations failed but
other(s) did not), nm(1) could reference the uninitialized value of these
allocations (undefined behavior).

Always initialize any successful allocations as the most expedient
resolution of the issue.  However, I would encourage upstream elftoolchain
contributors to clean up the error path to just abort immediately, rather
than proceeding sloppily when one allocation fails.

Reported by: Coverity
Sponsored by: Dell EMC Isilon
contrib/elftoolchain/nm/nm.c