~ubuntu-branches/ubuntu/gutsy/clamav/gutsy-backports

« back to all changes in this revision

Viewing changes to libclamav/sis.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2008-04-29 14:05:57 UTC
  • mfrom: (0.25.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080429140557-6d3m19fwq82pqa13
Tags: 0.92.1~dfsg2-1.1~gutsy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
#define EC32(x) le32_to_host(x) /* Convert little endian to host */
52
52
#define EC16(x) le16_to_host(x) /* Convert little endian to host */
53
53
 
54
 
extern short cli_leavetemps_flag;
55
 
 
56
54
static const char *langcodes[] = {
57
55
    "",   "EN", "FR", "GE", "SP", "IT", "SW", "DA", "NO", "FI", "AM",
58
56
    "SF", "SG", "PO", "TU", "IC", "RU", "HU", "DU", "BL", "AU", "BG",
79
77
 
80
78
 
81
79
    if(!length || length % 2) {
82
 
        cli_warnmsg("SIS: sis_utf16_decode: Broken filename (length == %d)\n", length);
 
80
        cli_dbgmsg("SIS: sis_utf16_decode: Broken filename (length == %d)\n", length);
83
81
        return NULL;
84
82
    }
85
83
 
296
294
            } 
297
295
 
298
296
            if(uncompress((Bytef *) buff, &osize , (Bytef *) mfile + fileoff, csize) != Z_OK) {
299
 
                cli_errmsg("SIS: sis_extract_simple: File decompression failed\n");
 
297
                cli_dbgmsg("SIS: sis_extract_simple: File decompression failed\n");
300
298
                free(buff);
301
299
                free(subdir);
302
300
                free(fname);
327
325
            free(fname);
328
326
            if(compressed)
329
327
                free(buff);
 
328
            close(desc);
330
329
            return CL_EIO;
331
330
        } else {
332
331
            if(compressed)
541
540
    cli_dbgmsg("SIS: Number of files: %d\n", nfiles);
542
541
    cli_dbgmsg("SIS: Offset of files records: %d\n", EC32(file_hdr.pfiles));
543
542
 
544
 
    if(!(dir = cli_gentempdir(NULL))) {
545
 
        cli_errmsg("SIS: Can't generate temporary directory\n");
546
 
        munmap(mfile, length);
547
 
        return CL_ETMPDIR;
548
 
    }
549
 
 
550
543
    if((frecord = EC32(file_hdr.pfiles)) >= length) {
551
544
        cli_errmsg("SIS: Broken file structure (frecord)\n");
552
545
        munmap(mfile, length);
553
 
        free(dir);
554
546
        return CL_EFORMAT;
555
547
    }
556
548
 
 
549
    dir = cli_gentemp(NULL);
 
550
    if(!dir || mkdir(dir, 0700) == -1) {
 
551
        cli_errmsg("SIS: Can't create temporary directory %s\n", dir ? dir : "");
 
552
        munmap(mfile, length);
 
553
        return CL_ETMPDIR;
 
554
    }
 
555
 
557
556
    for(i = 0; i < nfiles; i++) {
558
557
 
559
558
        cli_dbgmsg("SIS: -----\n");