Commit 4c0b3245 authored by Per Cederqvist's avatar Per Cederqvist

Check that conferences read from the database are the expected

size.  (Bug 168).
* src/server/simple-cache.c (read_person): Sanitycheck the
supplied size.
parent d7a1dbb1
2006-10-01 Per Cederqvist <ceder@lysator.liu.se>
Check that conferences read from the database are the expected
size. (Bug 168).
* src/server/simple-cache.c (read_person): Sanitycheck the
supplied size.
2006-09-29 Per Cederqvist <ceder@lysator.liu.se>
Check that conferences read from the database are the expected
......
......@@ -252,21 +252,33 @@ static Matching_info *find_matching_info(Conf_no conf_no);
static Person *
read_person(FILE *fp,
long pos,
long UNUSED(size)) /* FIXME (bug 168): sanity-check the size */
long size)
{
Person *p;
long dummy;
long pers_no;
long new_pos;
p = alloc_person();
fseek(fp, pos+1, SEEK_SET); /* Skip 'P' */
dummy = fparse_long(fp);
pers_no = fparse_long(fp);
if ( fparse_person(fp, p) != OK )
{
free_person(p);
return NULL;
}
else
return p;
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: Person %ld at %ld should be %ld bytes, "
"but %ld bytes was read\n",
pers_no, pos, size, new_pos - pos);
}
return p;
}
......
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