imv-scanner: Fix potential buffer overflow

While `pos` was moved to the end, `len` was not adjusted (i.e. set to 0)
so later calls could write beyond the buffer.  However, the last port
written might have been incomplete, so instead we just reset the string.
This commit is contained in:
Tobias Brunner 2020-08-18 13:18:52 +02:00
parent 3f8eb2ebdf
commit bdd058e36c
1 changed files with 0 additions and 1 deletions

View File

@ -429,7 +429,6 @@ METHOD(imv_agent_if_t, batch_ending, TNC_Result,
written = snprintf(pos, len, " %u", port);
if (written < 0 || written >= len)
{
pos += len - 1;
*pos = '\0';
}
else