From 1ddb99c46ffbeeac52f27a630b50670848b39e0c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 15 Sep 2014 18:28:15 +0200 Subject: string: Correctly burn the string buffer. Signed-off-by: Andreas Schneider Reviewed-by: Aris Adamantiadis --- src/string.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/string.c') diff --git a/src/string.c b/src/string.c index 5ef90b0e..9002478f 100644 --- a/src/string.c +++ b/src/string.c @@ -235,10 +235,11 @@ struct ssh_string_struct *ssh_string_copy(struct ssh_string_struct *s) { * @param[in] s The string to burn. */ void ssh_string_burn(struct ssh_string_struct *s) { - if (s == NULL) { - return; - } - memset(s->data, 'X', ssh_string_len(s)); + if (s == NULL || s->size == 0) { + return; + } + + BURN_BUFFER(s->data, ssh_string_len(s)); } /** -- cgit