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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user