Fix use-of-uninit memory on zeroinitializer.

0.96
Török Edvin 16 years ago
parent cbec3f2446
commit dcaa403826
  1. 11
      libclamav/bytecode.c

@ -811,6 +811,13 @@ static void readConstant(struct cli_bc *bc, unsigned i, unsigned comp,
unsigned len, char *ok)
{
unsigned j=0;
if (*ok && buffer[*offset] == 0x40 &&
buffer [*offset+1] == 0x60) {
/* zero initializer */
memset(bc->globals[i], 0, sizeof(*bc->globals[0])*comp);
(*offset)+=2;
return;
}
while (*ok && buffer[*offset] != 0x60) {
if (j >= comp) {
cli_errmsg("bytecode: constant has too many subcomponents, expected %u\n", comp);
@ -821,8 +828,8 @@ static void readConstant(struct cli_bc *bc, unsigned i, unsigned comp,
bc->globals[i][j++] = readNumber(buffer, offset, len, ok);
}
if (*ok && j != comp) {
cli_dbgmsg("bytecode: constant has too few subcomponents: %u < %u\n", j, comp);
/* *ok = 0; */
cli_errmsg("bytecode: constant has too few subcomponents: %u < %u\n", j, comp);
*ok = 0;
}
(*offset)++;
}

Loading…
Cancel
Save