opj_getopt_long(): avoid infinite loop on invalid or missing value for an option (#736)
This commit is contained in:
parent
1ab6e0e07a
commit
9f7d79fd30
|
@ -240,6 +240,7 @@ again:
|
||||||
'-') { /* Has read next input parameter: No arg for current parameter */
|
'-') { /* Has read next input parameter: No arg for current parameter */
|
||||||
if (opj_opterr) {
|
if (opj_opterr) {
|
||||||
fprintf(stderr, "%s: option requires an argument\n", arg);
|
fprintf(stderr, "%s: option requires an argument\n", arg);
|
||||||
|
++opj_optind;
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,6 +248,7 @@ again:
|
||||||
if (!opj_optarg) { /* missing argument */
|
if (!opj_optarg) { /* missing argument */
|
||||||
if (opj_opterr) {
|
if (opj_opterr) {
|
||||||
fprintf(stderr, "%s: option requires an argument\n", arg);
|
fprintf(stderr, "%s: option requires an argument\n", arg);
|
||||||
|
++opj_optind;
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue