From e731893208cd6e2401a2171672e6928b05947e3f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 31 Mar 2026 17:53:05 +0100 Subject: util/nvmutil: call usage if argc below 3 otherwise, we invoke the state machine in weird conditions, where some pointers may not be initialised. we could handle this properly, but why? therefore, the errhook is called after the argc check. this patch fixes a Speicherzugriffsfehler that i got while running nvmutil with below 3 arguments Signed-off-by: Leah Rowe --- util/libreboot-utils/nvmutil.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'util/libreboot-utils/nvmutil.c') diff --git a/util/libreboot-utils/nvmutil.c b/util/libreboot-utils/nvmutil.c index 3102bd50..26d15145 100644 --- a/util/libreboot-utils/nvmutil.c +++ b/util/libreboot-utils/nvmutil.c @@ -32,8 +32,11 @@ main(int argc, char *argv[]) struct xfile *f; size_t c; - (void) errhook(exit_cleanup); (void) lbsetprogname(argv[0]); + if (argc < 3) + usage(); + + (void) errhook(exit_cleanup); /* https://man.openbsd.org/pledge.2 */ /* https://man.openbsd.org/unveil.2 */ -- cgit v1.2.1