]> 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)
committerAlex Richardson <arichardson@FreeBSD.org>
Fri, 4 Dec 2020 15:53:37 +0000 (15:53 +0000)
commitf7ff7baaf62dd2e7b1f7b00c584cd4b968b4de1d
tree6eddd71f43098f6dea6067391ef011c00912a4ba
parentff15f3f1330ebc878bc18cc9ecaa41d21c44aff7
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