Skip to content

Commit 1577dab

Browse files
committed
query_parser: Fix potential out-of-bounds read (coverity)
CID 1190207 (uclouvain#1 of 1): Out-of-bounds read (OVERRUN) Variable i must be checked before testing query_param.box_type. Signed-off-by: Stefan Weil <[email protected]>
1 parent 3aaeea7 commit 1577dab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/openjpip/query_parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ void print_queryparam( query_param_t query_param)
264264
}
265265

266266
fprintf( logstream, "\t req-box-prop\n");
267-
for( i=0; query_param.box_type[i][0]!=0 && i<MAX_NUMOFBOX; i++){
267+
for( i=0; i<MAX_NUMOFBOX && query_param.box_type[i][0]!=0; i++){
268268
fprintf( logstream, "\t\t box_type: %.4s limit: %d w:%d s:%d g:%d a:%d priority:%d\n", query_param.box_type[i], query_param.limit[i], query_param.w[i], query_param.s[i], query_param.g[i], query_param.a[i], query_param.priority[i]);
269269
}
270270

0 commit comments

Comments
 (0)