diff --git a/src/tool_help.c b/src/tool_help.c index b4dce29904..3e21efd7a7 100644 --- a/src/tool_help.c +++ b/src/tool_help.c @@ -213,12 +213,18 @@ bool helpscan(unsigned char *buf, size_t len, struct scan_ctx *ctx) if(buf[i] == '\n') { DEBUGASSERT(ctx->olen < sizeof(ctx->obuf)); + if(ctx->olen == sizeof(ctx->obuf)) + return FALSE; /* bail out */ ctx->obuf[ctx->olen++] = 0; ctx->olen = 0; puts(ctx->obuf); } - else + else { + DEBUGASSERT(ctx->olen < sizeof(ctx->obuf)); + if(ctx->olen == sizeof(ctx->obuf)) + return FALSE; /* bail out */ ctx->obuf[ctx->olen++] = buf[i]; + } } return TRUE; } diff --git a/src/tool_help.h b/src/tool_help.h index 0a334464d2..4b40715375 100644 --- a/src/tool_help.h +++ b/src/tool_help.h @@ -37,7 +37,7 @@ struct scan_ctx { size_t elen; size_t olen; char rbuf[40]; - char obuf[80]; + char obuf[160]; unsigned char show; /* start as at 0. trigger match moves it to 1 arg match moves it to 2