Commit d7a1dbb1 authored by Per Cederqvist's avatar Per Cederqvist

Check that conferences read from the database are the expected

size.  (Bug 169).
* src/server/simple-cache.c (read_conference): Sanitycheck the
supplied size.
parent 147c0add
2006-09-29 Per Cederqvist <ceder@lysator.liu.se>
Check that conferences read from the database are the expected
size. (Bug 169).
* src/server/simple-cache.c (read_conference): Sanitycheck the
supplied size.
2006-09-28 Per Cederqvist <ceder@lysator.liu.se>
Renamed the error code illegal-aux-item to illegal-aux-item-tag.
......
......@@ -274,21 +274,33 @@ read_person(FILE *fp,
static Conference *
read_conference(FILE *fp,
long pos,
long UNUSED(size)) /* FIXME (bug 169): sanity-check the size */
long size)
{
Conference *c;
long dummy;
long conf_no;
long new_pos;
c = alloc_conference();
fseek(fp, pos+1, SEEK_SET); /* Skip 'C' */
dummy = fparse_long(fp);
conf_no = fparse_long(fp);
if ( fparse_conference(fp, c) != OK )
{
free_conference(c);
return NULL;
}
else
return c;
new_pos = ftell(fp);
if (new_pos < 0)
{
kom_log("ftell failed: %s. Ignored.\n", strerror(errno));
}
else if (new_pos != pos + size)
{
kom_log("WARNING: Conference %ld at %ld should be %ld bytes, "
"but %ld bytes was read\n",
conf_no, pos, size, new_pos - pos);
}
return c;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment