[hackers] [sbase] sbase-box: Fix segmentation fault when exe without args || Jules Maselbas
commit e24228e0626e9f8ee89272f0f42d9ff9be078346 Author: Jules Maselbas AuthorDate: Fri Dec 1 13:33:36 2023 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 28 20:16:54 2023 +0100 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`) diff --git a/scripts/mkbox b/scripts/mkbox index b9e9bb0..db2bdb9 100755 --- a/scripts/mkbox +++ b/scripts/mkbox @@ -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]);
Re: [hackers] [sbase] sbase-box: Fix segmentation fault when exe without args
Hi, On Fri, Dec 01, 2023 at 01:33:36PM +0100, Jules Maselbas wrote: > 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`) Applied, thanks!
[hackers] [sbase] sbase-box: Fix segmentation fault when exe without args || Jules Maselbas
commit d3a877d171ee8659fc05246a1529a20b7734c741 Author: Jules Maselbas AuthorDate: Fri Dec 1 13:33:36 2023 +0100 Commit: k0ga CommitDate: Tue Dec 5 11:00:17 2023 +0100 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`) diff --git a/scripts/mkbox b/scripts/mkbox index b9e9bb0..db2bdb9 100755 --- a/scripts/mkbox +++ b/scripts/mkbox @@ -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]);
[hackers] [sbase] 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`) --- scripts/mkbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mkbox b/scripts/mkbox index b9e9bb0..db2bdb9 100755 --- a/scripts/mkbox +++ b/scripts/mkbox @@ -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]); -- 2.42.1