git: 7e436c56ca38 - stable/12 - crunchgen: fix NULL-deref bug introduced in r364647
Kyle Evans
kevans at FreeBSD.org
Tue Dec 29 16:43:02 UTC 2020
The branch stable/12 has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=7e436c56ca3814a899d0ad04433fa1b1ed7f5570
commit 7e436c56ca3814a899d0ad04433fa1b1ed7f5570
Author: Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2020-12-04 15:53:37 +0000
Commit: Kyle Evans <kevans at FreeBSD.org>
CommitDate: 2020-12-29 16:37:32 +0000
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 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr.sbin/crunch/crunchgen/crunched_main.c b/usr.sbin/crunch/crunchgen/crunched_main.c
index 1b9ff1708538..5ce4416a137f 100644
--- a/usr.sbin/crunch/crunchgen/crunched_main.c
+++ b/usr.sbin/crunch/crunchgen/crunched_main.c
@@ -97,9 +97,9 @@ find_entry_point(const char *basename)
for (ep = entry_points; ep->name != NULL; ep++)
if (!strcmp(basename, ep->name))
- break;
+ return (ep);
- return (ep);
+ return (NULL);
}
static const char *
More information about the dev-commits-src-all
mailing list