git-svn: trunk@2649
Tomasz Kojm authored on 2007/01/30 00:19:51... | ... |
@@ -366,6 +366,12 @@ int cab_open(int fd, off_t offset, struct cab_archive *cab) |
366 | 366 |
|
367 | 367 |
/* files */ |
368 | 368 |
for(i = 0; i < cab->nfiles; i++) { |
369 |
+ if(bscore > 10) { |
|
370 |
+ cab_free(cab); |
|
371 |
+ cli_dbgmsg("CAB: bscore == %u, most likely a fake cabinet\n", bscore); |
|
372 |
+ return CL_EFORMAT; |
|
373 |
+ } |
|
374 |
+ |
|
369 | 375 |
if(cli_readn(fd, &file_hdr, sizeof(file_hdr)) != sizeof(file_hdr)) { |
370 | 376 |
cli_errmsg("cab_open: Can't read file %u header\n", i); |
371 | 377 |
cab_free(cab); |
... | ... |
@@ -414,7 +420,9 @@ int cab_open(int fd, off_t offset, struct cab_archive *cab) |
414 | 414 |
/* folder index */ |
415 | 415 |
if(fidx < 0xfffd) { |
416 | 416 |
if(fidx > cab->nfolders) { |
417 |
- cli_warnmsg("cab_open: File %s is not associated with any folder\n", file->name); |
|
417 |
+ if(bscore < 3) |
|
418 |
+ cli_warnmsg("cab_open: File %s is not associated with any folder\n", file->name); |
|
419 |
+ bscore++; |
|
418 | 420 |
free(file->name); |
419 | 421 |
free(file); |
420 | 422 |
continue; |
... | ... |
@@ -446,11 +454,6 @@ int cab_open(int fd, off_t offset, struct cab_archive *cab) |
446 | 446 |
|
447 | 447 |
lfile = file; |
448 | 448 |
|
449 |
- if(bscore > 10) { |
|
450 |
- cab_free(cab); |
|
451 |
- cli_dbgmsg("CAB: bscore == %u, most likely a fake cabinet\n", bscore); |
|
452 |
- return CL_EFORMAT; |
|
453 |
- } |
|
454 | 449 |
} |
455 | 450 |
|
456 | 451 |
return CL_SUCCESS; |