1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Use smemclr to wipe defunct bufchain segments.

A minor precaution against leaving secrets visible in process memory:
bufchains are used all over the place and probably _something_ in one
of them would be better wiped out of RAM.
This commit is contained in:
Simon Tatham 2019-03-01 19:21:46 +00:00
parent b9f20b84f3
commit e747e9e529

View File

@ -621,6 +621,7 @@ void bufchain_clear(bufchain *ch)
while (ch->head) {
b = ch->head;
ch->head = ch->head->next;
smemclr(b, sizeof(*b));
sfree(b);
}
ch->tail = NULL;
@ -691,6 +692,7 @@ void bufchain_consume(bufchain *ch, size_t len)
ch->head = tmp->next;
if (!ch->head)
ch->tail = NULL;
smemclr(tmp, sizeof(*tmp));
sfree(tmp);
} else
ch->head->bufpos += remlen;