]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r331078 (cem): nm: Initialize allocated memory before use
authoremaste <emaste@FreeBSD.org>
Fri, 9 Nov 2018 21:38:53 +0000 (21:38 +0000)
committeremaste <emaste@FreeBSD.org>
Fri, 9 Nov 2018 21:38:53 +0000 (21:38 +0000)
commite68e4b5e04e60680ff62819038c00e7492036129
treef0205429fcf58d2b6cd645b18c128943a6cc3f77
parent260328ef4daed793b253796d0d2c99f37e81f025
MFC r331078 (cem): nm: 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.
contrib/elftoolchain/nm/nm.c