Changeset c9c1ccd in mainline for uspace/app/mkext4/mkext4.c


Ignore:
Timestamp:
2018-12-12T16:23:36Z (5 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4f38ad77, 91fc2dae, af8c793b
Parents:
737ebf3 (diff), 6abdef37 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Maurizio Lombardi <m.lombardi85@…> (2018-12-12 16:23:36)
git-committer:
GitHub <noreply@…> (2018-12-12 16:23:36)
Message:

Merge pull request #141 from maurizio-lombardi/mkext4_fix_loop

mkext4: fix infinite loop when passing an invalid argument.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/mkext4/mkext4.c

    r737ebf3 rc9c1ccd  
    6868        ++argv;
    6969
    70         while (*argv[0] == '-') {
     70        while (*argv && *argv[0] == '-') {
    7171                if (str_cmp(*argv, "--size") == 0) {
    7272                        --argc;
     
    8787                        --argc;
    8888                        ++argv;
     89                        continue;
    8990                }
    9091
     
    107108                        --argc;
    108109                        ++argv;
     110                        continue;
    109111                }
    110112
     
    122124                        --argc;
    123125                        ++argv;
     126                        continue;
     127                }
     128
     129                if (str_cmp(*argv, "--help") == 0) {
     130                        syntax_print();
     131                        return 0;
    124132                }
    125133
     
    128136                        ++argv;
    129137                        break;
     138                } else {
     139                        printf(NAME ": Invalid argument: %s\n", *argv);
     140                        syntax_print();
     141                        return 1;
    130142                }
    131143        }
Note: See TracChangeset for help on using the changeset viewer.