File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -254,10 +254,14 @@ char **read_filelist(char *filename) {
254
254
}
255
255
256
256
int nb_entries = 1 ;
257
- for (int i = 0 ; i < file_stat.total_size ; i++) {
257
+ for (u8 i = 0 ; i < file_stat.total_size ; i++) {
258
258
if (data[i] == ' \n ' ) {
259
259
nb_entries++;
260
260
}
261
+ if (nb_entries == INT_MAX) {
262
+ fprintf (stderr, " too many input files" );
263
+ return NULL ;
264
+ }
261
265
}
262
266
263
267
size_t sizeof_array = sizeof (char *) * (nb_entries + 1 );
@@ -271,7 +275,7 @@ char **read_filelist(char *filename) {
271
275
// Create the corresponding array
272
276
int j = 1 ;
273
277
filelist[0 ] = content;
274
- for (int i = 0 ; i < file_stat.total_size ; i++) {
278
+ for (u8 i = 0 ; i < file_stat.total_size ; i++) {
275
279
if (content[i] == ' \n ' ) {
276
280
content[i] = 0 ;
277
281
if (i + 1 < file_stat.total_size ) {
You can’t perform that action at this time.
0 commit comments