~yolanda.robla/ubuntu/saucy/clamav/dep-8-tests

« back to all changes in this revision

Viewing changes to libclamav/pe.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2009-11-02 23:27:19 UTC
  • mfrom: (0.35.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091102232719-61ay35095dhbuxfm
Tags: 0.95.3+dfsg-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop build-dep on electric-fence (in Universe)
  - Build-dep on libltdl3-dev instead of libltdl-dev for updating earlier
    releases more easily
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
644
644
    }
645
645
 
646
646
    /* This will be a chicken and egg problem until we drop 9x */
647
 
    if(EC32(optional_hdr64.Magic)==PE32P_SIGNATURE) {
 
647
    if(EC16(optional_hdr64.Magic)==PE32P_SIGNATURE) {
648
648
        if(EC16(file_hdr.SizeOfOptionalHeader)!=sizeof(struct pe_image_optional_hdr64)) {
649
649
            /* FIXME: need to play around a bit more with xp64 */
650
650
            cli_dbgmsg("Incorrect SizeOfOptionalHeader for PE32+\n");
927
927
                for(j = 0; j < md5_sect->soff_len && md5_sect->soff[j] <= exe_sections[i].rsz; j++) {
928
928
                    if(md5_sect->soff[j] == exe_sections[i].rsz) {
929
929
                        unsigned char md5_dig[16];
930
 
                        if(cli_md5sect(desc, &exe_sections[i], md5_dig) && cli_bm_scanbuff(md5_dig, 16, ctx->virname, ctx->engine->md5_mdb, 0, 0, -1) == CL_VIRUS) {
931
 
                            if(cli_bm_scanbuff(md5_dig, 16, NULL, ctx->engine->md5_fp, 0, 0, -1) != CL_VIRUS) {
 
930
                        const struct cli_bm_patt *patt;
 
931
                        if(cli_md5sect(desc, &exe_sections[i], md5_dig) && cli_bm_scanbuff(md5_dig, 16, ctx->virname, &patt, ctx->engine->md5_mdb, 0, 0, -1) == CL_VIRUS && patt->filesize == exe_sections[i].rsz) {
 
932
                            if(cli_bm_scanbuff(md5_dig, 16, NULL, &patt, ctx->engine->md5_fp, 0, 0, -1) != CL_VIRUS || patt->filesize != fsize) {
932
933
 
933
934
                                free(section_hdr);
934
935
                                free(exe_sections);
2287
2288
        return -1;
2288
2289
    }
2289
2290
 
2290
 
    if(EC32(optional_hdr64.Magic)==PE32P_SIGNATURE) { /* PE+ */
 
2291
    if(EC16(optional_hdr64.Magic)==PE32P_SIGNATURE) { /* PE+ */
2291
2292
        if(EC16(file_hdr.SizeOfOptionalHeader)!=sizeof(struct pe_image_optional_hdr64)) {
2292
2293
            cli_dbgmsg("Incorrect SizeOfOptionalHeader for PE32+\n");
2293
2294
            return -1;