diff --git a/src/tcpcheck.c b/src/tcpcheck.c index 55fd190cf..117be3275 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -2047,6 +2047,13 @@ enum tcpcheck_eval_ret tcpcheck_eval_expect(struct check *check, struct tcpcheck break; case TCPCHK_EXPECT_CUSTOM: + /* Don't eval custom function if the buffer is empty. It means + * cusstom functions can't expect an empty response. If this + * change, don't forget to change this test and update all + * custom functions. + */ + if (!b_data(&check->bi)) + break; if (expect->custom) ret = expect->custom(check, rule, last_read); goto out;