From: Stephan Bosch Date: Thu, 2 Nov 2023 13:33:50 +0000 (+0100) Subject: auth: test-mech - Fix empty initial reponse tests X-Git-Tag: 2.4.0~2433 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e2cfc70eca03b845510bfbf2fe9d1157b002af0;p=thirdparty%2Fdovecot%2Fcore.git auth: test-mech - Fix empty initial reponse tests Empty initial responses were interpreted as the absense of an initial response, thereby triggering an empty server challenge and a subsequent erroneous failure. This was not how these tests were intended. --- diff --git a/src/auth/test-mech.c b/src/auth/test-mech.c index d6150a1cd1..d574e78ae8 100644 --- a/src/auth/test-mech.c +++ b/src/auth/test-mech.c @@ -341,8 +341,8 @@ static void test_mechs(void) test_expect_error_string(test_case->expect_error); request->state = AUTH_REQUEST_STATE_NEW; - unsigned char *input_dup = test_case->len == 0 ? NULL : - i_memdup(test_case->in, test_case->len); + unsigned char *input_dup = i_malloc(I_MAX(test_case->len, 1)); + memcpy(input_dup, test_case->in, test_case->len); request->initial_response = input_dup; request->initial_response_len = test_case->len; auth_request_initial(request);