@@ -556,7 +556,7 @@ int wolfSSL_SetEchConfigsBase64(WOLFSSL* ssl, char* echConfigs64,
556556/* set the ech config from a raw buffer, this is the format ech configs are
557557 * sent using retry_configs from the ech server */
558558int wolfSSL_SetEchConfigs(WOLFSSL* ssl, const byte* echConfigs,
559- word32 echConfigsLen)
559+ word32 echConfigsLen)
560560{
561561 int ret = 0;
562562 int i;
@@ -683,16 +683,17 @@ int wolfSSL_SetEchConfigs(WOLFSSL* ssl, const byte* echConfigs,
683683 &workingConfig->cipherSuites[j].aeadId);
684684 }
685685 echConfig += cipherSuitesLen;
686+ /* ignore the maximum name length */
687+ echConfig++;
686688 /* publicNameLen */
687- ato16 (echConfig, &publicNameLen );
689+ publicNameLen = * (echConfig);
688690 workingConfig->publicName = (char*)XMALLOC(publicNameLen + 1,
689691 ssl->heap, DYNAMIC_TYPE_TMP_BUFFER);
690692 if (workingConfig->publicName == NULL) {
691693 ret = MEMORY_E;
692694 break;
693695 }
694-
695- echConfig += 2;
696+ echConfig++;
696697 /* publicName */
697698 XMEMCPY(workingConfig->publicName, echConfig, publicNameLen);
698699 /* null terminated */
@@ -869,9 +870,13 @@ int GetEchConfig(WOLFSSL_EchConfig* config, byte* output, word32* outputLen)
869870 output += 2;
870871 }
871872
873+ /* set maximum name length to 0 */
874+ *output = 0;
875+ output++;
876+
872877 /* publicName len */
873- c16toa( XSTRLEN(config->publicName), output );
874- output += 2 ;
878+ *output = XSTRLEN(config->publicName);
879+ output++ ;
875880
876881 /* publicName */
877882 XMEMCPY(output, config->publicName,
0 commit comments