]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
crunchgen: fix NULL-deref bug introduced in r364647
authorarichardson <arichardson@FreeBSD.org>
Fri, 4 Dec 2020 15:53:37 +0000 (15:53 +0000)
committerarichardson <arichardson@FreeBSD.org>
Fri, 4 Dec 2020 15:53:37 +0000 (15:53 +0000)
commit1c55ddac7d75c6a569e8de408f7cdc86b5b772c8
tree6eddd71f43098f6dea6067391ef011c00912a4ba
parenta8aa08ab6c36b400b7e98d7ac02760f528afb8df
crunchgen: fix NULL-deref bug introduced in r364647

While porting over the local changes from CheriBSD for upstreaming, I
accidentally committed a broken version of find_entry_point(): we have to
return NULL if the value is not found instead of a value with
ep->name == NULL, since the checks in main were changed to check ep instead
of ep->name for NULL.

This only matters if the crunched tool cannot be found using normal lookup
and one of the fallback paths is used, so it's unlikely to be triggered
in rescue. However, I noticed that one of our CheriBSD test scripts was
failing to run commands under `su` on minimal disk images where all
binaries are hardlinks to a `cheribsdbox` tool generated with crunchgen.

This also updates the bootstrapping check in Makefile.inc1 to bootstrap
crunchgen up to the next version bump.

Reviewed By: kevans
Differential Revision: https://reviews.freebsd.org/D27474
Makefile.inc1
usr.sbin/crunch/crunchgen/crunched_main.c