string: Correctly burn the string buffer.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
(cherry picked from commit 1ddb99c46f)
This commit is contained in:
Andreas Schneider
2014-09-15 18:28:15 +02:00
parent bbf172a79c
commit a30e234c03

View File

@@ -235,10 +235,11 @@ struct ssh_string_struct *ssh_string_copy(struct ssh_string_struct *s) {
* @param[in] s The string to burn. * @param[in] s The string to burn.
*/ */
void ssh_string_burn(struct ssh_string_struct *s) { void ssh_string_burn(struct ssh_string_struct *s) {
if (s == NULL) { if (s == NULL || s->size == 0) {
return; return;
} }
memset(s->data, 'X', ssh_string_len(s));
BURN_BUFFER(s->data, ssh_string_len(s));
} }
/** /**