sbase-box: Fix segmentation fault when exe without args

when sbase-box is executed without argument, the check sbase-box
options doesn't verify the argument count leading to a segfault.

Add a check on the argc before parsing sbase-box options (currently
only `-i`)
This commit is contained in:
Jules Maselbas 2023-12-01 13:33:36 +01:00 committed by Roberto E. Vargas Caballero
parent 6a557314b9
commit e24228e062
1 changed files with 1 additions and 1 deletions

View File

@ -76,7 +76,7 @@ main(int argc, char *argv[])
char *s = basename(argv[0]);
struct cmd *bp;
if(!strcmp(s,"sbase-box")) {
if (!strcmp(s, "sbase-box") && argc > 1) {
argc--; argv++;
if (strcmp(argv[0], "-i") == 0) {
install(argv[1]);