diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-04-18 09:09:05 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-04-18 10:24:47 +0200 |
commit | 3f562ee5861fe194316c05b95aa624b74ce630da (patch) | |
tree | 71ee273b4558b95aadf3b1a63a13117a19b368a1 /src/buffer.c | |
parent | eb796b4bbb86fc488cf3d444f36e5f4a3120d959 (diff) | |
download | libssh-3f562ee5861fe194316c05b95aa624b74ce630da.tar.gz libssh-3f562ee5861fe194316c05b95aa624b74ce630da.tar.xz libssh-3f562ee5861fe194316c05b95aa624b74ce630da.zip |
buffer: Do not call explicit_bzero with null arguments
This allows compiling and testing with undefined sanitizer.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index 89fd0f6d..7001eef0 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -195,7 +195,9 @@ static void buffer_shift(ssh_buffer buffer){ int ssh_buffer_reinit(struct ssh_buffer_struct *buffer) { buffer_verify(buffer); - explicit_bzero(buffer->data, buffer->used); + if (buffer->used > 0) { + explicit_bzero(buffer->data, buffer->used); + } buffer->used = 0; buffer->pos = 0; |