mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-02 12:45:20 +01:00
Remove Extraneous bytes from buffer post pem write
In order to remove large buffers from the stack, the der data is written into the same buffer that the pem is eventually written into, however although the pem data is zero terminated, there is now data left in the buffer after the zero termination, which can cause mbedtls_x509_crt_parse to fail to parse the same buffer if passed back in. Patches also applied to mbedtls_pk_write_pubkey_pem, and mbedtls_pk_write_key_pem, which use similar methods of writing der data to the same buffer, and tests modified to hopefully catch any future regression on this. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
3f35b87db9
commit
319b5939dd
4 changed files with 42 additions and 5 deletions
6
ChangeLog.d/clean_pem_buffers.txt
Normal file
6
ChangeLog.d/clean_pem_buffers.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Bugfix
|
||||
* In PEM writing functions, fill the trailing part of the buffer with null
|
||||
bytes. This guarantees that the corresponding parsing function can read
|
||||
the buffer back, which was the case for mbedtls_x509write_{crt,csr}_pem
|
||||
until this property was inadvertently broken in Mbed TLS 2.19.0.
|
||||
Fixes #3682.
|
||||
Loading…
Add table
Add a link
Reference in a new issue