fix loading from .cvd.

Chomp first line too, and look for \0 instead of \n.
0.96
Török Edvin 16 years ago
parent f6e8bb802a
commit c1aff5ec76
  1. 3
      libclamav/bytecode.c

@ -470,7 +470,7 @@ static int parseHeader(struct cli_bc *bc, unsigned char *buffer, unsigned *linel
}
offset++;
*linelength = strtol(buffer+offset, &pos, 10);
if (*pos != '\n') {
if (*pos != '\0') {
cli_errmsg("Invalid number: %s\n", buffer+offset);
return CL_EMALFDB;
}
@ -1241,6 +1241,7 @@ int cli_bytecode_load(struct cli_bc *bc, FILE *f, struct cli_dbio *dbio, int tru
cli_errmsg("Unable to load bytecode (empty file)\n");
return CL_EMALFDB;
}
cli_chomp(firstbuf);
rc = parseHeader(bc, (unsigned char*)firstbuf, &linelength);
if (rc == CL_BREAK) {
bc->state = bc_skip;

Loading…
Cancel
Save