1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

Merge pull request #3898 from paul-elliott-arm/fix_pem_write

Remove Extraneous bytes from buffer post pem write
This commit is contained in:
Gilles Peskine
2020-12-08 12:31:40 +01:00
committed by GitHub
4 changed files with 42 additions and 5 deletions

View File

@@ -478,8 +478,12 @@ int mbedtls_pem_write_buffer( const char *header, const char *footer,
*p++ = '\0';
*olen = p - buf;
/* Clean any remaining data previously written to the buffer */
memset( buf + *olen, 0, buf_len - *olen );
mbedtls_free( encode_buf );
return( 0 );
}
#endif /* MBEDTLS_PEM_WRITE_C */
#endif /* MBEDTLS_PEM_PARSE_C || MBEDTLS_PEM_WRITE_C */