Read the local header of the current zipfile Check the coherency of the local header and info in the end of central directory about this file store in *piSizeVar the size of extra info in local header (filename and size of extra field data) */
(s,piSizeVar, poffset_local_extrafield, psize_local_extrafield)
| 803 | (filename and size of extra field data) |
| 804 | */ |
| 805 | local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, |
| 806 | poffset_local_extrafield, |
| 807 | psize_local_extrafield) |
| 808 | unz_s* s; |
| 809 | uInt* piSizeVar; |
| 810 | uLong *poffset_local_extrafield; |
| 811 | uInt *psize_local_extrafield; |
| 812 | { |
| 813 | uLong uMagic,uData,uFlags; |
| 814 | uLong size_filename; |
| 815 | uLong size_extra_field; |
| 816 | int err=UNZ_OK; |
| 817 | |
| 818 | *piSizeVar = 0; |
| 819 | *poffset_local_extrafield = 0; |
| 820 | *psize_local_extrafield = 0; |
| 821 | |
| 822 | if (fseek(s->file,s->cur_file_info_internal.offset_curfile + |
| 823 | s->byte_before_the_zipfile,SEEK_SET)!=0) |
| 824 | return UNZ_ERRNO; |
| 825 | |
| 826 | |
| 827 | if (err==UNZ_OK) |
| 828 | if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) |
| 829 | err=UNZ_ERRNO; |
| 830 | else if (uMagic!=0x04034b50) |
| 831 | err=UNZ_BADZIPFILE; |
| 832 | |
| 833 | if (unzlocal_getShort(s->file,&uData) != UNZ_OK) |
| 834 | err=UNZ_ERRNO; |
| 835 | /* |
| 836 | else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) |
| 837 | err=UNZ_BADZIPFILE; |
| 838 | */ |
| 839 | if (unzlocal_getShort(s->file,&uFlags) != UNZ_OK) |
| 840 | err=UNZ_ERRNO; |
| 841 | |
| 842 | if (unzlocal_getShort(s->file,&uData) != UNZ_OK) |
| 843 | err=UNZ_ERRNO; |
| 844 | else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) |
| 845 | err=UNZ_BADZIPFILE; |
| 846 | |
| 847 | if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && |
| 848 | (s->cur_file_info.compression_method!=Z_DEFLATED)) |
| 849 | err=UNZ_BADZIPFILE; |
| 850 | |
| 851 | if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */ |
| 852 | err=UNZ_ERRNO; |
| 853 | |
| 854 | if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* crc */ |
| 855 | err=UNZ_ERRNO; |
| 856 | else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && |
| 857 | ((uFlags & 8)==0)) |
| 858 | err=UNZ_BADZIPFILE; |
| 859 | |
| 860 | if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size compr */ |
| 861 | err=UNZ_ERRNO; |
| 862 | else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && |
no test coverage detected