initializing file->folder to NULL to prevent accidental segfaults and valgrind complaints. adding correction to mspack_fmap_message() so it will correctly print format strings.

remotes/push_mirror/msnyder-clamav-mspack
Micah Snyder 8 years ago
parent 4cb7530e81
commit 87c800a746
  1. 3
      libclamav/libmspack-0.5alpha/mspack/cabd.c
  2. 6
      libclamav/libmspack.c

@ -441,6 +441,7 @@ static int cabd_read_headers(struct mspack_system *sys,
return MSPACK_ERR_NOMEMORY;
}
file->folder = NULL;
file->next = NULL;
file->length = EndGetI32(&buf[cffile_UncompressedSize]);
file->attribs = EndGetI16(&buf[cffile_Attribs]);
@ -1008,6 +1009,8 @@ static int cabd_extract(struct mscab_decompressor *base,
if ( (file->offset > CAB_LENGTHMAX) || (file->length > CAB_LENGTHMAX) ||
((file->offset + file->length) > CAB_LENGTHMAX))
{
sys->message(NULL, "ERROR; file \"%s\" cannot be extracted, "
"invalid file offset and length.", file->filename);
return self->error = MSPACK_ERR_DATAFORMAT;
}

@ -8,6 +8,7 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdarg.h>
#include <mspack.h>
@ -255,8 +256,11 @@ static off_t mspack_fmap_tell(struct mspack_file *file)
static void mspack_fmap_message(struct mspack_file *file, const char *fmt, ...)
{
va_list argList;
UNUSEDPARAM(file);
cli_dbgmsg("%s() %s\n", __func__, fmt);
va_start(argList, fmt);
cli_dbgmsg(fmt, argList );
va_end(argList);
}
static void *mspack_fmap_alloc(struct mspack_system *self, size_t num)
{

Loading…
Cancel
Save