From: Timo Sirainen Date: Wed, 26 Aug 2020 08:42:02 +0000 (+0300) Subject: auth: test-mech - Allocate test input explicitly X-Git-Tag: 2.3.13~132 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e29ce296cff923a9e94e1647958bc7e5a69d5268;p=thirdparty%2Fdovecot%2Fcore.git auth: test-mech - Allocate test input explicitly This way valgrind will catch if there are read buffer overflows. --- diff --git a/src/auth/test-mech.c b/src/auth/test-mech.c index d9429c95d8..322c1e9c69 100644 --- a/src/auth/test-mech.c +++ b/src/auth/test-mech.c @@ -343,7 +343,9 @@ static void test_mechs(void) test_expect_error_string(test_case->expect_error); request->state = AUTH_REQUEST_STATE_NEW; - request->initial_response = test_case->in; + unsigned char *input_dup = test_case->len == 0 ? NULL : + i_memdup(test_case->in, test_case->len); + request->initial_response = input_dup; request->initial_response_len = test_case->len; auth_request_initial(request); @@ -381,6 +383,7 @@ static void test_mechs(void) event_unref(&request->event); event_unref(&request->mech_event); + i_free(input_dup); mech->auth_free(request); test_end();