]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
crunchgen: fix NULL-deref bug introduced in r364647
authorAlex Richardson <arichardson@FreeBSD.org>
Fri, 4 Dec 2020 15:53:37 +0000 (15:53 +0000)
committerKyle Evans <kevans@FreeBSD.org>
Tue, 29 Dec 2020 16:37:32 +0000 (10:37 -0600)
commit7e436c56ca3814a899d0ad04433fa1b1ed7f5570
tree76ccfbfe8ffe64f88b70409c2abb65c09f8fa04c
parent51f54754d53ea255c901d4bdca18a3619f2ba496
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.

(cherry picked from commit f7ff7baaf62dd2e7b1f7b00c584cd4b968b4de1d)
usr.sbin/crunch/crunchgen/crunched_main.c