projects
/
openjpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e5ab168
)
opj_getopt.c: avoid crash on invalid input (#301)
author
Even Rouault
<even.rouault@spatialys.com>
Sat, 2 Sep 2017 22:30:36 +0000
(
00:30
+0200)
committer
Even Rouault
<even.rouault@spatialys.com>
Sat, 2 Sep 2017 22:30:36 +0000
(
00:30
+0200)
src/bin/common/opj_getopt.c
patch
|
blob
|
history
diff --git
a/src/bin/common/opj_getopt.c
b/src/bin/common/opj_getopt.c
index 5db94ca05fd77826970e4fd7f27584307ac129a6..11ccfc59b740fa366c7b5222a239643f494e6ec6 100644
(file)
--- a/
src/bin/common/opj_getopt.c
+++ b/
src/bin/common/opj_getopt.c
@@
-160,12
+160,15
@@
again:
}
if (argv[opj_optind][0] == '-') { /* long option */
- char* arg
= argv[opj_optind] + 1
;
+ char* arg;
const opj_option_t* o;
o = longopts;
len = sizeof(longopts[0]);
if (param > 1) {
+ if (opj_optind + 1 >= argc) {
+ return -1;
+ }
arg = argv[opj_optind + 1];
opj_optind++;
} else {