Merge remote-tracking branch 'upstream/master'

pull/25/head
Shawn Webb 13 years ago
commit 8fb38bb70b
  1. 14
      libclamav/mspack.c
  2. 1
      libclamav/mspack.h
  3. 2
      unit_tests/check_clamav.c

@ -126,12 +126,22 @@ static const unsigned short mszip_bit_mask_tab[17] = {
static int mszip_read_input(struct mszip_stream *zip) {
int nread = zip->read_cb(zip->file, zip->inbuf, (int)zip->inbuf_size);
if (nread < 0) {
if (zip->file->error == CL_BREAK)
return zip->error = CL_BREAK;
if (zip->file->error == CL_BREAK) {
if (nread == zip->last) {
cli_dbgmsg("mszip_read_input: Two consecutive CL_BREAKs reached.\n");
return CL_BREAK;
}
// Need short circuit to ensure scanning small files
cli_dbgmsg("mszip_read_input: First CL_BREAK reached.\n");
zip->i_ptr = zip->i_end;
zip->last = nread;
return CL_SUCCESS;
}
else
return zip->error = CL_EFORMAT;
}
zip->last = nread;
zip->i_ptr = &zip->inbuf[0];
zip->i_end = &zip->inbuf[nread];

@ -84,6 +84,7 @@ struct mszip_stream {
int (*read_cb)(struct cab_file *, unsigned char *, int);
unsigned char wflag; /* write flag */
unsigned int last; /* prior end of content buffer */
};

@ -432,7 +432,7 @@ static int get_test_file(int i, char *file, unsigned fsize, unsigned long *size)
}
#ifdef CHECK_HAVE_LOOPS
static ssize_t pread_cb(void *handle, void *buf, size_t count, off_t offset)
static off_t pread_cb(void *handle, void *buf, size_t count, off_t offset)
{
return pread(*((int*)handle), buf, count, offset);
}

Loading…
Cancel
Save