opj_getopt_long(): avoid infinite loop on invalid or missing value for an option (#736)

This commit is contained in:
Even Rouault 2017-08-17 14:52:10 +02:00
parent 1ab6e0e07a
commit 9f7d79fd30
1 changed files with 2 additions and 0 deletions

View File

@ -240,6 +240,7 @@ again:
'-') { /* Has read next input parameter: No arg for current parameter */
if (opj_opterr) {
fprintf(stderr, "%s: option requires an argument\n", arg);
++opj_optind;
return (BADCH);
}
}
@ -247,6 +248,7 @@ again:
if (!opj_optarg) { /* missing argument */
if (opj_opterr) {
fprintf(stderr, "%s: option requires an argument\n", arg);
++opj_optind;
return (BADCH);
}
}