diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2014-09-15 18:28:15 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2014-09-15 20:46:06 +0200 |
commit | a30e234c03ff776ff58c1f9d94a83901b8d17f8d (patch) | |
tree | 387fba826e452829e4747412edcffbbbef69eeff | |
parent | bbf172a79c9e175faa2bacf3a4f36040690f8d47 (diff) | |
download | libssh-a30e234c03ff776ff58c1f9d94a83901b8d17f8d.tar.gz libssh-a30e234c03ff776ff58c1f9d94a83901b8d17f8d.tar.xz libssh-a30e234c03ff776ff58c1f9d94a83901b8d17f8d.zip |
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 1ddb99c46ffbeeac52f27a630b50670848b39e0c)
-rw-r--r-- | src/string.c | 9 |
1 files changed, 5 insertions, 4 deletions
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)); } /** |