@@ -3089,8 +3089,8 @@ static word16 TLSX_CSR_GetSize(CertificateStatusRequest* csr, byte isRequest)
30893089 return size ;
30903090}
30913091
3092- static word16 TLSX_CSR_Write (CertificateStatusRequest * csr , byte * output ,
3093- byte isRequest )
3092+ static int TLSX_CSR_Write (CertificateStatusRequest * csr , byte * output ,
3093+ byte isRequest )
30943094{
30953095 /* shut up compiler warnings */
30963096 (void ) csr ; (void ) output ; (void ) isRequest ;
@@ -3119,6 +3119,9 @@ static word16 TLSX_CSR_Write(CertificateStatusRequest* csr, byte* output,
31193119 if (ret > 0 ) {
31203120 length = (word16 )ret ;
31213121 }
3122+ else {
3123+ return ret ;
3124+ }
31223125 }
31233126
31243127 c16toa (length , output + offset );
@@ -3127,7 +3130,7 @@ static word16 TLSX_CSR_Write(CertificateStatusRequest* csr, byte* output,
31273130 break ;
31283131 }
31293132
3130- return offset ;
3133+ return ( int ) offset ;
31313134 }
31323135#endif
31333136#if defined(WOLFSSL_TLS13 ) && !defined(NO_WOLFSSL_SERVER )
@@ -3555,7 +3558,7 @@ static word16 TLSX_CSR2_GetSize(CertificateStatusRequestItemV2* csr2,
35553558 return size ;
35563559}
35573560
3558- static word16 TLSX_CSR2_Write (CertificateStatusRequestItemV2 * csr2 ,
3561+ static int TLSX_CSR2_Write (CertificateStatusRequestItemV2 * csr2 ,
35593562 byte * output , byte isRequest )
35603563{
35613564 /* shut up compiler warnings */
@@ -3600,6 +3603,9 @@ static word16 TLSX_CSR2_Write(CertificateStatusRequestItemV2* csr2,
36003603 if (ret > 0 ) {
36013604 length = (word16 )ret ;
36023605 }
3606+ else {
3607+ return ret ;
3608+ }
36033609 }
36043610
36053611 c16toa (length , output + offset );
@@ -3611,7 +3617,7 @@ static word16 TLSX_CSR2_Write(CertificateStatusRequestItemV2* csr2,
36113617 /* list size */
36123618 c16toa (offset - OPAQUE16_LEN , output );
36133619
3614- return offset ;
3620+ return ( int ) offset ;
36153621 }
36163622#endif
36173623
@@ -12614,15 +12620,23 @@ static int TLSX_Write(TLSX* list, byte* output, byte* semaphore,
1261412620
1261512621 case TLSX_STATUS_REQUEST :
1261612622 WOLFSSL_MSG ("Certificate Status Request extension to write" );
12617- offset + = CSR_WRITE ((CertificateStatusRequest * )extension -> data ,
12623+ ret = CSR_WRITE ((CertificateStatusRequest * )extension -> data ,
1261812624 output + offset , isRequest );
12625+ if (ret > 0 ) {
12626+ offset += (word16 )ret ;
12627+ ret = 0 ;
12628+ }
1261912629 break ;
1262012630
1262112631 case TLSX_STATUS_REQUEST_V2 :
1262212632 WOLFSSL_MSG ("Certificate Status Request v2 extension to write" );
12623- offset + = CSR2_WRITE (
12633+ ret = CSR2_WRITE (
1262412634 (CertificateStatusRequestItemV2 * )extension -> data ,
1262512635 output + offset , isRequest );
12636+ if (ret > 0 ) {
12637+ offset += (word16 )ret ;
12638+ ret = 0 ;
12639+ }
1262612640 break ;
1262712641
1262812642 case TLSX_RENEGOTIATION_INFO :
0 commit comments