From 3f562ee5861fe194316c05b95aa624b74ce630da Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Wed, 18 Apr 2018 09:09:05 +0200 Subject: [PATCH] buffer: Do not call explicit_bzero with null arguments This allows compiling and testing with undefined sanitizer. Signed-off-by: Nikos Mavrogiannopoulos Reviewed-by: Andreas Schneider --- src/buffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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;