unit-tests: Don't use test data on stack for TLS socket tests

The stack of that function might not be valid anymore once data is read.
This commit is contained in:
Tobias Brunner
2022-09-15 12:16:12 +02:00
parent 80b2c6cdc5
commit bdc7f84a23
+6 -1
View File
@@ -647,6 +647,11 @@ static void run_echo_client(echo_server_config_t *config)
server->destroy(server); server->destroy(server);
} }
/**
* Data for echo test
*/
static chunk_t echo_data = chunk_from_chars(0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08);
/** /**
* Create server/peer configuration * Create server/peer configuration
*/ */
@@ -660,7 +665,7 @@ static echo_server_config_t *create_config(tls_version_t version, uint16_t port,
.addr = "127.0.0.1", .addr = "127.0.0.1",
.port = port, .port = port,
.cauth = cauth, .cauth = cauth,
.data = chunk_from_chars(0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08), .data = echo_data,
); );
return config; return config;
} }