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
Родитель b9f20b84f3
Коммит e747e9e529
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -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;