Skip to content

Commit 94234bd

Browse files
committed
test_tile_decoder: Fix potential buffer overflow (coverity)
CID 1190155 (uclouvain#1 of 1): Unbounded source buffer (STRING_SIZE) Using a pointer instead of buffer of fixed size avoids the limit for the length of the input file name. Signed-off-by: Stefan Weil <[email protected]>
1 parent 045aa4d commit 94234bd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/test_tile_decoder.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ int main (int argc, char *argv[])
178178
int da_y0=0;
179179
int da_x1=1000;
180180
int da_y1=1000;
181-
char input_file[64];
181+
const char *input_file;
182182

183183
/* should be test_tile_decoder 0 0 1000 1000 tte1.j2k */
184184
if( argc == 6 )
@@ -187,7 +187,7 @@ int main (int argc, char *argv[])
187187
da_y0=atoi(argv[2]);
188188
da_x1=atoi(argv[3]);
189189
da_y1=atoi(argv[4]);
190-
strcpy(input_file,argv[5]);
190+
input_file = argv[5];
191191

192192
}
193193
else
@@ -196,7 +196,7 @@ int main (int argc, char *argv[])
196196
da_y0=0;
197197
da_x1=1000;
198198
da_y1=1000;
199-
strcpy(input_file,"test.j2k");
199+
input_file = "test.j2k";
200200
}
201201

202202
if (! l_data) {

0 commit comments

Comments
 (0)