diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-31 17:53:05 +0100 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-31 17:54:48 +0100 |
| commit | e731893208cd6e2401a2171672e6928b05947e3f (patch) | |
| tree | c64964fc6ffbd57c9c7445b8b91fb5f1501ecb27 /util/libreboot-utils/nvmutil.c | |
| parent | d2abde53033d58b6665becd75f854ad87aba33f6 (diff) | |
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 <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/nvmutil.c')
| -rw-r--r-- | util/libreboot-utils/nvmutil.c | 5 |
1 files changed, 4 insertions, 1 deletions
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 */ |
