From c7b2dfbf1d41e998a03fdfcf23f54aaf901e0b88 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Thu, 14 Jun 2018 17:17:07 -0600 Subject: [PATCH] sanity check on arguments with debug --- src/internal.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/internal.c b/src/internal.c index 1ca1557..30ff771 100644 --- a/src/internal.c +++ b/src/internal.c @@ -2701,10 +2701,12 @@ static int DoDebug(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) char* msg = NULL; char* lang = NULL; word32 strSz; - word32 begin = *idx; + word32 begin; - (void)ssh; - (void)len; + if (ssh == NULL || buf == NULL || idx == NULL || len < LENGTH_SZ + 1) { + return WS_BAD_ARGUMENT; + } + begin = *idx; alwaysDisplay = buf[begin++];