mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05: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:
parent
b9f20b84f3
commit
e747e9e529
2
utils.c
2
utils.c
@ -621,6 +621,7 @@ void bufchain_clear(bufchain *ch)
|
|||||||
while (ch->head) {
|
while (ch->head) {
|
||||||
b = ch->head;
|
b = ch->head;
|
||||||
ch->head = ch->head->next;
|
ch->head = ch->head->next;
|
||||||
|
smemclr(b, sizeof(*b));
|
||||||
sfree(b);
|
sfree(b);
|
||||||
}
|
}
|
||||||
ch->tail = NULL;
|
ch->tail = NULL;
|
||||||
@ -691,6 +692,7 @@ void bufchain_consume(bufchain *ch, size_t len)
|
|||||||
ch->head = tmp->next;
|
ch->head = tmp->next;
|
||||||
if (!ch->head)
|
if (!ch->head)
|
||||||
ch->tail = NULL;
|
ch->tail = NULL;
|
||||||
|
smemclr(tmp, sizeof(*tmp));
|
||||||
sfree(tmp);
|
sfree(tmp);
|
||||||
} else
|
} else
|
||||||
ch->head->bufpos += remlen;
|
ch->head->bufpos += remlen;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user