rely on the decode function
diff --git a/lib/picotls.c b/lib/picotls.c
index b531218..323b23c 100644
--- a/lib/picotls.c
+++ b/lib/picotls.c
@@ -2850,17 +2850,13 @@
src = end;
break;
case PTLS_EXTENSION_TYPE_ENCRYPTED_CLIENT_HELLO: {
- struct st_decoded_ech_config_t decoded;
- if (src == end) {
- ret = PTLS_ALERT_DECODE_ERROR;
- goto Exit;
- }
/* accept retry_configs only if we offered ECH but rejected */
if (!(tls->ech.offered && !ptls_is_ech_handshake(tls, NULL, NULL))) {
ret = PTLS_ALERT_UNSUPPORTED_EXTENSION;
goto Exit;
}
/* parse retry_config, and if it is applicable, provide that to the application */
+ struct st_decoded_ech_config_t decoded;
if ((ret = decode_ech_config_list(tls->ctx, &decoded, ptls_iovec_init(src, end - src))) != 0)
goto Exit;
if (decoded.kem != NULL && decoded.cipher != NULL && properties != NULL &&