DataSoft/Nova — Issue #78: SuspectTable CheckOut/Checkin can bypass AddNewSuspect
Author: PherricOxide
Created: 2012-03-09 20:48:01+00:00
State: open
Labels: Component:Lib, Type:Bug

Bit of an odd case I found while testing. Easiest to describe with example code,

Suspect *s = new Suspect(); // Test suspect
s->SetIpAddress(42);
SuspectTable table; // Make a new table

table.CheckIn(s); // Returns KEY_INVALID as expected
table.CheckOut(42); // Returns empty suspect/failure as expected
table.CheckIn(s); // Now returns SUCCESS, should still be KEY_INVALID

It looks like CheckOut creates and empty suspect in the table under whatever key you pass to CheckOut. After that, you can Checkin a suspect with that same key even though you never called AddNewSuspect. I would guess that this will make the keys vector and table out of sync and cause all sorts of strange bugs if it was actually done.